4 ms·
Hey - #8 regarding "consulting the prototype chain if the value is an object" is something of an oversimplification, and slightly incorrect. The prototype chain
by mckinnsb 12y ago
Hey - #8 regarding "consulting the prototype chain if the value is an object" is something of an oversimplification, and slightly incorrect. The prototype chain is more or less always consulted because that is the only way to evaluate the property on a child scope.
What is happening in the first example is that the ng-bind directive is creating a new entry on the child scope, called "user", which overwrites the reference to the property defined in the parent scope. When you ng-bind an attribute of an object, your child scope is not changing the reference to the original object, so both scopes will show updates.
Example fiddle: http://jsfiddle.net/02f4o7u9/1/ http://jsfiddle.net/02f4o7u9/1/
- nuclearghost 12y agoYeah I agree it's an oversimplification. It's tough when writing a piece like this where a deep level of language knowledge is required to make a clear explanation. I tried to lead people toward the cause without getting bogged down in too many details. Thanks for the example!