Angularjs Examples

AJS Examples


AngularJS $scope.$broadcast() Function

The AngularJS $broadcast method is used to dispatches an event name downward to all child scopes notify the registered $rootScope listeners. The $broadcast propagates event name downward and travel toward the child scopes and calls all registered listeners along the way. All listeners for event name on this scope get notified. In $broadcast, event cannot be cancelled.

The difference between $emit and $broadcast method is, the way they propagate or travelled from the source.

Syntax

AngularJS $scope.$broadcast() Function Example