forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.scope.$broadcast.html
23 lines (21 loc) · 1.35 KB
/
angular.scope.$broadcast.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<h1>angular.scope.$broadcast</h1>
<div class="angular-scope-broadcast"><h2>Description</h2>
<div class="description"><p>Dispatches an event <code>name</code> downwards to all child scopes (and their children) notifying the
registered <a href="#!/api/angular.scope.$on"><code>angular.scope.$on</code></a> listeners.</p>
<p>The event life cycle starts at the scope on which <code>$broadcast</code> was called. All
<a href="#!/api/angular.scope.$on"><code>listeners</code></a> listening for <code>name</code> event on this scope get notified.
Afterwards, the event propagates to all direct and indirect scopes of the current scope and
calls all registered listeners along the way. The event cannot be canceled.</p>
<p>Any exception emmited from the <a href="#!/api/angular.scope.$on"><code>listeners</code></a> will be passed
onto the <a href="#!/api/angular.service.$exceptionHandler"><code>$exceptionHandler</code></a> service.</p></div>
<h2>Usage</h2>
<div class="usage"><div ng:non-bindable=""><pre class="brush: js; html-script: true;">angular.scope.$broadcast(name, args);</pre>
</div>
<h3>Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">name – {string} – </code>
<p>Event name to emit.</p></li>
<li><code ng:non-bindable="">args – {...*} – </code>
<p>Optional set of arguments which will be passed onto the event listeners.</p></li>
</ul>
</div>
</div>