0% found this document useful (0 votes)
49 views2 pages

R - Filters - Asp Angularjs - Filters: SR - No. Name & Description Uppercase

Filters are used to modify data in AngularJS expressions and directives. The document describes 5 commonly used filters - uppercase, lowercase, currency, filter and orderBy. Uppercase and lowercase convert text to upper or lower case. Currency formats numbers with a currency symbol. Filter filters an array based on criteria. OrderBy orders an array based on criteria. Examples are given showing how each filter is used by adding it to an expression with a pipe character.

Uploaded by

santhoshaimit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views2 pages

R - Filters - Asp Angularjs - Filters: SR - No. Name & Description Uppercase

Filters are used to modify data in AngularJS expressions and directives. The document describes 5 commonly used filters - uppercase, lowercase, currency, filter and orderBy. Uppercase and lowercase convert text to upper or lower case. Currency formats numbers with a currency symbol. Filter filters an array based on criteria. OrderBy orders an array based on criteria. Examples are given showing how each filter is used by adding it to an expression with a pipe character.

Uploaded by

santhoshaimit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

https://www.w3schools.

com/angular/angula
r_filters.asp
AngularJS - Filters

Filters are used to modify the data. They can be clubbed in expression or directives using pipe (|)
character. The following list shows the commonly used filters.

Sr.No. Name & Description


uppercase
1
converts a text to upper case text.
lowercase
2
converts a text to lower case text.
currency
3
formats text in a currency format.
filter
4
filter the array to a subset of it based on provided criteria.
orderby
5
orders the array based on provided criteria.

Uppercase Filter

Add uppercase filter to an expression using pipe character. Here we've added uppercase filter
to print student name in all capital letters.

Enter first name:<input type = "text" ng-model = "student.firstName">


Enter last name: <input type = "text" ng-model = "student.lastName">
Name in Upper Case: {{student.fullName() | uppercase}}
Lowercase Filter

Add lowercase filter to an expression using pipe character. Here we've added lowercase filter
to print student name in all lowercase letters.

Enter first name:<input type = "text" ng-model = "student.firstName">


Enter last name: <input type = "text" ng-model = "student.lastName">
Name in Lower Case: {{student.fullName() | lowercase}}
Currency Filter

Add currency filter to an expression returning number using pipe character. Here we've added
currency filter to print fees using currency format.

Enter fees: <input type = "text" ng-model = "student.fees">


fees: {{student.fees | currency}}
Filter

To display only required subjects, we use subjectName as filter.

Enter subject: <input type = "text" ng-model = "subjectName">


Subject:
<ul>
<li ng-repeat = "subject in student.subjects | filter: subjectName">
{{ subject.name + ', marks:' + subject.marks }}
</li>
</ul>
OrderBy Filter

To order subjects by marks, we use orderBy marks.

Subject:
<ul>
<li ng-repeat = "subject in student.subjects | orderBy:'marks'">
{{ subject.name + ', marks:' + subject.marks }}
</li>
</ul>

You might also like