This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,6 @@ function $RootScopeProvider(){
248
248
* can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
249
249
* listener was called due to initialization.
250
250
*
251
- * The example below contains an illustration of using a function as your $watch listener
252
251
*
253
252
*
254
253
* # Example
@@ -278,14 +277,14 @@ function $RootScopeProvider(){
278
277
279
278
280
279
281
- // Using a listener function
280
+ // Using a function as a watchExpression
282
281
var food;
283
282
scope.foodCounter = 0;
284
283
expect(scope.foodCounter).toEqual(0);
285
284
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
287
286
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
289
288
function(newValue, oldValue) {
290
289
if ( newValue !== oldValue ) {
291
290
// Only increment the counter if the value changed
You can’t perform that action at this time.
0 commit comments