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.
This is an Angular 1.3.0 issue. I was using firefox and tested on Chrome.
I was having a play with the bindone syntax and track by.
If you have a track by in a repeater and you bind once on a value, then you cannot change the value on the bound once value after the original binding (as you would expect). However, as soon as you add to the list then the change comes through. Plunkr provided to illustrate what I mean:-
The "Modify Key" button modifies the key of the first item, the "Modify Value" button modifies the value of the first item. The "Add" button will add a value to the list.
If you do the following:-
Click on "Modify Key"
Click on "Modify Value"
Then, the bound once first value does not change. However, if you then click on add, then the bound once value is updated.
What I was hoping was to see is the bound once value would not be updated until the key changed - after which time the DOM would be re-rendered and the new value would be displayed. This would mean that we could use the track by mechanism as a means of significantly reducing the number of watchers. This was probably naive of me. Irrespective of how I feel it should work, I think it should work consistently - that is, it should either not change in all cases or change only when the key changes.
The text was updated successfully, but these errors were encountered:
This works as expected. ngRepeat uses $watchCollection to check for changes in the collection. If you update only the key of an object, ngRepeat doesn't trigger the track by check etc at all. If you add an item, it will find that the key has changed, and rerender the changed item, which causes the change in the value to be picked up.
This is an Angular 1.3.0 issue. I was using firefox and tested on Chrome.
I was having a play with the bindone syntax and track by.
If you have a track by in a repeater and you bind once on a value, then you cannot change the value on the bound once value after the original binding (as you would expect). However, as soon as you add to the list then the change comes through. Plunkr provided to illustrate what I mean:-
http://plnkr.co/edit/u3Rbb40UKQYuTcK5pc94?p=preview
The "Modify Key" button modifies the key of the first item, the "Modify Value" button modifies the value of the first item. The "Add" button will add a value to the list.
If you do the following:-
Then, the bound once first value does not change. However, if you then click on add, then the bound once value is updated.
What I was hoping was to see is the bound once value would not be updated until the key changed - after which time the DOM would be re-rendered and the new value would be displayed. This would mean that we could use the track by mechanism as a means of significantly reducing the number of watchers. This was probably naive of me. Irrespective of how I feel it should work, I think it should work consistently - that is, it should either not change in all cases or change only when the key changes.
The text was updated successfully, but these errors were encountered: