Fix scope of compilation for event handlers

(makes it possible for a handler to be defined in a custom directive's
controller)