- I have a
<ul>
which contains the directive ng-repeat. - Inside it, I have multiple "li" which contains a directive :
<li directive>
. - The array (A) which serves the directive ng-repeat contains comments. And when the user adds comment, I want display its comment before all of others. For do this, I build an other array (B). I inject the new comment first, and then the comments from the array (A) after. In others words, I change (A) into (B) by a simple assignation (=).
The ng-repeat updates the DOM from the new content of array (A) but... but the DOM element which is binds on the directive isn't the true element, I mean the element which is in link function isn't the first comment !
This is hard to explains this, I hope you know what I want mean.
PS: If the array (A) is empty and if I adds a comment (li) the directive binds on the true element. But if there is one or more comments, that causes the problem that I have explained.
Thx you.