Angular Range Filter


JS: var myApp = angular.module(‘myApp’, []); myApp.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); return input; }; }); HTML: <select ng-options=”n for n in [] | range:1:30″></select> Advertisements