Inconsistent behaviour with track by and bindone when adding to list. #9508
Description
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:-
- 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.