Skip to content

Commit 1194390

Browse files
Strikeskidsnetman92
authored andcommitted
docs($rootScope.Scope): improve clarity describing $watch with no listener
The previous explanation in parentheses created a bit of confusion because the documentation stated to leave off the `listener`, but then said "be prepared for multiple calls to your listener". The new explanation clarifies that it is indeed the `watchExpression` that will be executed multiple times. Closes angular#12429
1 parent dfca6f1 commit 1194390

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ng/rootScope.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ function $RootScopeProvider() {
276276
*
277277
*
278278
* If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
279-
* you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
280-
* can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a
281-
* change is detected, be prepared for multiple calls to your listener.)
279+
* you can register a `watchExpression` function with no `listener`. (Be prepared for
280+
* multiple calls to your `watchExpression` because it will execute multiple times in a
281+
* single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)
282282
*
283283
* After a watcher is registered with the scope, the `listener` fn is called asynchronously
284284
* (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the

0 commit comments

Comments
 (0)