angular.scope.$on

Description

Listen on events of a given type. See $emit for discussion of event life cycle.

Usage

angular.scope.$on(name, listener);

Parameters

Returns

{function()}

Returns a deregistration function for this listener.

The event listener function format is: function(event). The event object passed into the listener has the following attributes - targetScope - {Scope}: the scope on which the event was $emit-ed or $broadcast-ed. - currentScope - {Scope}: the current scope which is handling the event. - name - {string}: Name of the event. - cancel - {function=}: calling cancel function will cancel further event propagation (available only for events that were $emit-ed).