With reference to:

https://docs.angularjs.org/api/ng/type/$rootScope.Scope


Specifically the section on $watch:

$watch(watchExpression, [listener], [objectEquality]);

Registers a listener callback to be executed whenever the watchExpression
 changes.

   - The watchExpression is called on every call to 
$digest()<https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest> and 
   should return the value that will be watched. (Since 
$digest()<https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest>reruns
 
   when it detects changes the watchExpression can execute multiple times 
   per 
$digest()<https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest> and 
   should be idempotent.)
   - The listener is called only when the value from the current 
   watchExpression and the previous call to watchExpressionare not equal 
   (with the exception of the initial run, see below). The inequality is 
   determined according to 
angular.equals<https://docs.angularjs.org/api/ng/function/angular.equals>
   function....*etc*


The sentence highlighted in yellow is the line in question. 

According to:

https://github.com/angular/angular.js/blob/master/src/ng/rootScope.js#L330


and

https://github.com/angular/angular.js/blob/master/src/ng/rootScope.js#L680


angular.equals is only used when objectEquality is set to true.

The problem is that if you are watching an object, without setting 
objectEquality (the third parameter) to be true, looking to rely on the 
sentence in yellow, you are going to be disappointed:

http://plnkr.co/edit/hK27HO?p=preview


Have I missed something here, or should the wording in yellow be corrected? 

Both documentation and test performed against tip/head.

Thanks 


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to