Hi, here we will demonstrate a simple an example of AngularJS Filter.
AngularJS Filters format the value of an expression for display to the user. Filters can be added to expressions by using the pipe character |. Following is the list of commonly used filters.
UPPERCASE FILTER
Ther uppercase filter to an expression using pipe character it format strings to upper case. Below we've added uppercase filter to print name in all capital letters.
Enter Name: <input type="text" ng-model="User.Name">
Name in Upper Case: {{User.Name | uppercase}}
LOWERCASE FILTER
Ther lowercase filter to an expression using pipe character it format strings to lower case. Below we've added lowercase filter to print name in all lowercase letters.
Enter Name: <input type="text" ng-model="User.Name">
Name in Upper Case: {{User.Name | lowercase }}
Currency filter
The currency filter to an expression using pipe character it formats a number as currency. Below we've added currency filter to print fee using currency format.
ENTER AMOUNT: <INPUT TYPE="TEXT" NG-MODEL="USER.FEE">
FEES: {{USER.FEE | CURRENCY}}
filter filters
The filter filters selects a subset of an array List.The filter filters can only be used on arrays, and it returns an array containing only the matching records. . Below we've added Filter filters to display only matching records.
Anonymous User
27-Nov-2020Hi, here we will demonstrate a simple an example of AngularJS Filter.
AngularJS Filters format the value of an expression for display to the user. Filters can be added to expressions by using the pipe character |. Following is the list of commonly used filters.
UPPERCASE FILTER
Ther uppercase filter to an expression using pipe character it format strings to upper case. Below we've added uppercase filter to print name in all capital letters.
LOWERCASE FILTER
Ther lowercase filter to an expression using pipe character it format strings to lower case. Below we've added lowercase filter to print name in all lowercase letters.
Currency filter
The currency filter to an expression using pipe character it formats a number as currency. Below we've added currency filter to print fee using currency format.
filter filters
The filter filters selects a subset of an array List.The filter filters can only be used on arrays, and it returns an array containing only the matching records. . Below we've added Filter filters to display only matching records.
orderby filter
The orderby filter can return an arrays, it is use for sorting array record. Below we've added orderby filter to display sorting records.
Simple Example:
Output:
I hope it will help to you.