From f88297fc3c4514ab41e88ce51a1e944b33538f7b Mon Sep 17 00:00:00 2001 From: Ole Date: Fri, 21 Aug 2015 10:17:00 +0200 Subject: [PATCH] Make more explicit that oldValues will contain last different value for watchGroup To avoid confusion like https://github.com/angular/angular.js/issues/8671 and https://github.com/angular/angular.js/issues/12452 and http://plnkr.co/edit/Ir1X88bRL95mvm7l6f4N?p=preview. --- src/ng/rootScope.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index 3bbabfb7cf6c..9b12053ecc58 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -418,8 +418,9 @@ function $RootScopeProvider() { * expression in `watchExpressions` changes * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching * those of `watchExpression` - * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching - * those of `watchExpression` + * and the `oldValues` array contains the value of each `watchExpression` before the last change (it + * will contain an older value if this `watchExpression` has not changed since `listener` was last + * called). The indexes match those of `watchExpression`. * The `scope` refers to the current scope. * @returns {function()} Returns a de-registration function for all listeners. */