Angularjs Examples

AJS Examples


AngularJS $scope.$emit() Function

The AngularJS $emit method is used to dispatches an event name upwards and travel up to $rootScope.scope listeners. The $emit propagatesevent name upward and travel upwards toward $rootScope.scope listeners and calls all registered listeners along the way. The difference between $emit and $broadcast method is, the way they propagate or travelled from the source.

The life cycle of the event are starts when $emit method is called. The event traverses upwards toward the $rootScope.scope. The event will stop propagating if one of the listeners cancels it.

Syntax

AngularJS $scope.$emit() Function Example