Q:

Duplicate in ng-repeat

Angular doesn't allow to have duplicate elements in an array declared in ng-repeat as explained here.
But what if I temporarily have a dup in my function (because I'm reordering the array) and when the function returns there's no dup? will that work? 

A:

You should have read your link carefully.
You can have duplicate keys, you just have to add a 'track by'.
example to use "track by"
 ng-repeat="message in messages track by $index"

Also, if you order your list inside your controller and have sometimes a duplicate, it's not that bad.
Your controller will execute all his code, and when it will have finished, angular will trigger its $digest, where he will evaluate the new values inside the scope.

