I'm playing with angular 2 alpha 44.
I have a tree model and use recursivity to display it. Each group contain 'Criterions', 'Segments' and others 'Groups'. We can delete and add all of these elements at any level.
There is a weird behavior when I remove elements and then add others on a same level.
The new order is wrong, new elements got a bigger position
property and array are sort on this property but they appears where elements were removed..
The new array is logged in the console and appears in the right order. And if you remove and add all the tree using the "SHOW/HIDE" button, the view is now in the right order.
You can see this behavior in this plunker and understand easily:
- Remove the first element
- Add a new element
- See that order in the view is not right and not identical as inside the console log
- Click 2 times on "SHOW/HIDE" button
- See that order in the view is now correct
Is there something like ng1 trackBy
with ng2 NgFor
?
I found nothing about it inside sources..