Just raised the following PR:

https://github.com/angular/angular.js/pull/7633

On Wednesday, 28 May 2014 20:43:06 UTC+1, rodyhaddad wrote:
>
> This works as expected.
>
> It seems objectEquality got added way back in 2012 
> <https://github.com/angular/angular.js/commit/d6e3e1baabc3acc930e4fda387b62cbd03e64577#diff-1e47cbafadbdba153d94f2abee2a8451L194>
>  
> without the proper doc description update.
>
> The wording in yellow should be corrected, maybe by adding an extra bullet 
> point that only addresses objectEquality, with its performance/memory 
> implications.
>
> Would you like to send a PR to fix the doc?
>
> On Wednesday, May 14, 2014 12:02:20 PM UTC-7, Paul Jolly wrote:
>>
>> 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