Understanding $emit, $broadcast and $on in AngularJS |
Posted: February 12, 2016 |
Sometimes we need to send data from one controller to another. There are services provided by AngularJS for communication(event-based) between the controllers. $on, $emit, $broadcast are the services for the communication between the controllers. $on :- $on is used to catch the event dispatched by $broadcast and $emit. Basically it’s a method of scope and listens on events of a given type. $broadcast : - $broadcast is the service that dispatches an event downwards to the child scopes. The life cycle of the event starts at the scope where the $broadcast is called. For example :-
Here is not the end… See ful blog about Understanding $emit, $broadcast and $on in AngularJS visit Findnerd. Also visit Findnerd for such more interesting articles related to Javascript, Android, AngularJS etc.
|
|||||||||||||||||||||||||||||||||||||||||||
|