refactor(ngRepeat): rearrange code flow

Rearrange the codes according to their corresponding positions within the ngRepeat expression.