You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Programmers want this directive!
Google has many examples with ng-range, ng-repeat-range, but a lot of them working through compiling to e.g ng-repeat="n in [1,2,3,4,5,6]". This may create a large arrays in memory.
I want to see the ng-range directive as: <div ng-range="5"> {{ n }} </div> - renders my element 5 times (n is a default alias) <div ng-range="5 as x"> {{ x }} </div> - x is an new alias <div ng-range="1 to 10"> {{ n }} </div> <div ng-range="1 to 10 as x"> {{ x }} </div> <div ng-range="10 step 2"> {{ n }} </div> <div ng-range="10 step 2 as x"> {{ x }} </div> <div ng-range="1 to 10 step 2"> {{ n }} </div> <div ng-range="1 to 10 step 2 as x"> {{ x }} </div>
I wrote the RegExp for parse this string. /^(.+?)(?:\s*to\s*(.+?))?(?:\s*step\s*(.+?))?(?:\s*as\s*(\w+))?$/.