Setting UID's to branches should happen after the plain-string typed leaves are converted to objects. Otherwise the uid for those leaves is not set and Angular outputs the ngRepeat:dupes error. Moved the conversion before the uid-assignment.