Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2e0a4e3

Browse files
docs(Scope): clarify naming in the $watch example
Fixes #8254 Closes #8271
1 parent 1f533ad commit 2e0a4e3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/ng/rootScope.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ function $RootScopeProvider(){
248248
* can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
249249
* listener was called due to initialization.
250250
*
251-
* The example below contains an illustration of using a function as your $watch listener
252251
*
253252
*
254253
* # Example
@@ -278,14 +277,14 @@ function $RootScopeProvider(){
278277
279278
280279
281-
// Using a listener function
280+
// Using a function as a watchExpression
282281
var food;
283282
scope.foodCounter = 0;
284283
expect(scope.foodCounter).toEqual(0);
285284
scope.$watch(
286-
// This is the listener function
285+
// This function returns the value being watched. It is called for each turn of the $digest loop
287286
function() { return food; },
288-
// This is the change handler
287+
// This is the change listener, called when the value returned from the above function changes
289288
function(newValue, oldValue) {
290289
if ( newValue !== oldValue ) {
291290
// Only increment the counter if the value changed

0 commit comments

Comments
 (0)