Angular Range Filter


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++)
    return input;


<select ng-options="n for n in [] | range:1:30"></select>

AngularJS – All about building Custom Filters

Today, we will build our own custom AngularJS filters. We’ll start simple and build a couple filters that manipulate numbers and strings, then we’ll build a filter that manipulate an entire data set. Finally, in our previous article where we discussed the built in AngularJS filters, Pierre-Adrien asked how we could use the built in Angular currency filter to display the currency denomination after the amount (i.e. 9.99$ instead of $9.99) as is common in some places of the world. Unfortunately, the built-in currency filter does not support this functionality, so we’ll build our own that does!

Read original article with demo –

Happy Coding … 🙂