Created
August 22, 2016 18:58
-
-
Save raphaelfruneaux/bb228e5ae90520b0bfbbaab43ce96fd4 to your computer and use it in GitHub Desktop.
Angularjs range filter, n for n in [] | range:0:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select name="HH" data-ng-model="" style="width:auto;" | |
data-ng-options="n for n in [] | range:0:20" required> | |
<option value="">----</option> | |
</select> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('Filters', []). | |
filter('range', function () { | |
return function (input, min, max) { | |
min = parseInt(min); //Make string input int | |
max = parseInt(max); | |
for (var i = min; i < max; i++) | |
input.push(i.toString().padLeft(2, "0")); | |
return input; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment