i am new in angular and i am bit familiar with filter
word but what is filterFilter
word and usage in angular. just come across a code below from this url https://stackoverflow.com/a/22704140/6188148.
angular.module('FilterInControllerModule', []).
controller('FilterController', ['filterFilter', function(filterFilter) {
this.array = [
{name: 'Tobias'},
{name: 'Jeff'},
{name: 'Brian'},
{name: 'Igor'},
{name: 'James'},
{name: 'Brad'}
];
this.filteredArray = filterFilter(this.array, {name:'Igor'});
}]);
just tell me what is filterFilter
? is it any built-in filter ?
Every filter can be injected as a service, whose name is <theNameOfTheFilter>Filter
.
So, for example, if you want to use the uppercase
filter from a controller (for example), you can do
module.controller('MyController', function($scope, uppercaseFilter) {
$scope.foo = uppercaseFilter('hello');
});
Your code does the same thing, with the filter
filter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With