refactor(ngRepeat): simplify the code

This re-introduce the PR #1018: "refactor(ng-repeat): refactor fix for
#1015" which had been reverted.