Tag Archives: Filter

How to create Custom Filters in AngularJs?

Creating custom filter is simple in AngularJs. You just need to create controller and then create filter.

For declaring controller do as following,

app.controller(‘myCtrl’, function(){});

For creating filter append following to your Angular application,

.filter(‘filterName’, function(){});

Example of filter to find which languages are static:

var app = angular.module(‘filters’, []);

app.controller(‘demo’, function($scope){
$scope.example1 = [
{name: 'C#', type : 'static'},
{name: 'PHP', type : 'dynamic'},
{name: 'Go', type : 'static'},
{name: 'Rust', type: 'static'}

app.filter(‘staticLanguage‘, function(){
return function(input){
var out = [];
angular.forEach(input, function(language){
if(language.type === ‘static’){
return out;

In your View to apply filter write following:

<li ng-repeat=”lang in example1 | staticLanguage“>{{lang.name}}</li>

ProsperaSoft offers AngularJs development solutions. You can email at info@prosperasoft.com to get in touch with ProsperaSoft AngularJs experts and consultants.