Revert "Revert "refactor(ng-repeat): refactor the fix for #1015""

This reverts commit 4421710002f13670294eada527855b5021206c4a.