You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I have noticed that one-time binding with :: always wants to deep-copy objects in an expression, whereas normal binding will simply store and compare a reference.
This example demonstrates the inconsistent behavior by binding to an object that holds a reference to a $scope. The one-time binding prompts an ng:cpws error, indicating that a deep copy is being made.
I would prefer the traditional behavior for various reasons. But in any case, I assume that this inconsistency was not deliberate.
The text was updated successfully, but these errors were encountered:
mhelvens
changed the title
One-time binding always deep-copies an object
One-time binding deep-copies an object
Jun 19, 2014
If there is an interpolated expression with multiple parts, one of them is
an object and the other is not a one-time bonded expression, then the
former is transformed to json. Now, if you change the former in-place (this
is you change some property of the object without changing the object
instance), then, when you change the second expression, the first
expression is interpolated once again and the updated json is displayed. #7700 uses watchGroup that fixes this issue without he need for a copy.
I have noticed that one-time binding with
::
always wants to deep-copy objects in an expression, whereas normal binding will simply store and compare a reference.Minimal example: http://jsfiddle.net/mhelvens/PXdkK/1/
This example demonstrates the inconsistent behavior by binding to an object that holds a reference to a
$scope
. The one-time binding prompts anng:cpws
error, indicating that a deep copy is being made.I would prefer the traditional behavior for various reasons. But in any case, I assume that this inconsistency was not deliberate.
The text was updated successfully, but these errors were encountered: