Custom Filters
At some point of time we came across the situation where we need some filtering and formatting of data based upon some particular conditions.Our existing filters do not help us and finally we have to come up with our custom solution i:e custom filters.
Syntax For Creating Custom filters
1) Add filter
2) Provide it name & callback function
3) Return anonymous function with filtered data.
4) In anonymous function, pass data need to be filtered as first parameter & then any other parameters.
My First Custom Filter In Action
Above filter takes the number array and return the set of even numbers.
Summary
1) Filters are used to filter and format data.
2) We can apply filter at html with the help of | symbol & pass parameter to filter with : symbol.
3) We can apply filter in JavaScript controller using $filter service,
4) We can create custom filters and chain them to any angular module.
5) Filter are function to which we pass input to get required result.
At some point of time we came across the situation where we need some filtering and formatting of data based upon some particular conditions.Our existing filters do not help us and finally we have to come up with our custom solution i:e custom filters.
Syntax For Creating Custom filters
1) Add filter
2) Provide it name & callback function
3) Return anonymous function with filtered data.
4) In anonymous function, pass data need to be filtered as first parameter & then any other parameters.
My First Custom Filter In Action
Above filter takes the number array and return the set of even numbers.
Summary
1) Filters are used to filter and format data.
2) We can apply filter at html with the help of | symbol & pass parameter to filter with : symbol.
3) We can apply filter in JavaScript controller using $filter service,
4) We can create custom filters and chain them to any angular module.
5) Filter are function to which we pass input to get required result.
No comments:
Post a Comment