This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
feature(ngRepeat): add ruby style ranges #3861
Closed
Description
Would it be useful to support ranges in the ng-repeat
directive? For example, I'm implementing pagination, and simply want an incremental array from 1 to the amount of pages. For that I'm doing a simple for
loop to populate an array which I loop through the traditional way. However, by supporting ranges we could eradicate that boilerplate code.
We could support the Ruby syntax, and support both double-period (..
) and triple-period (...
):
ng-repeat="index in [1...pages.length]"
Alternatively of course I could just create an abstract method for my array fill. Although I'm confident pagination won't be anywhere close to the only scenario where a range in the ngRepeat
directive would be desirable.