December 2014
Intermediate to advanced
272 pages
8h 17m
English
To handle an event that is emitted or broadcasted, you use the $on() method. The $on() method uses the following syntax, where name is the name of the event to listen for:
scope.$on(name, listener)
The listener parameter is a function that accepts the event as the first parameter and any arguments passed by the $emit() or $broadcast() method as subsequent parameters. The event object has the following properties:
■ targetScope: The scope from which $emit() or $broadcast() was called.
■ currentScope: The scope that is currently handling the event.
■ name: The name of the event.
■ stopPropagation(): A function that stops the event from being propagated up or down the scope hierarchy.
■ preventDefault(): A ...
Read now
Unlock full access