Currently experimenting with Angular 2 alpha version 44.
Working with a tree model that utilizes recursion for display purposes. Each group contains 'Criterions', 'Segments', and other 'Groups'. Elements can be added or deleted at any level of the tree.
Encountering a strange issue when removing elements and adding new ones on the same level. The new elements are getting assigned a higher position
property, causing the array to sort incorrectly. Despite the console showing the correct order, the view displays the items where the previously removed elements were positioned.
Upon logging the new array in the console, it appears in the correct order. Also, if you delete and add all tree elements using the "SHOW/HIDE" button, the view then displays in the proper sequence.
To observe this behavior firsthand and gain better understanding, please visit: Plunker link here:
- Remove the first element
- Add a new element
- Notice that the view's order does not match the console log
- Click the "SHOW/HIDE" button twice
- The view should now correctly display the order of elements
Is there an equivalent to ng1's trackBy
functionality for ng2's NgFor
? I couldn't find any reference to it within the sources.