Filter of AngularJS basic knowledge notes and basic angularjs knowledge

Source: Internet
Author: User

Filter of AngularJS basic knowledge notes and basic angularjs knowledge

Filters are used to modify data and can be classified into expressions or using pipeline instructions. The following is a list of commonly used filters.

S. No. Name Description
1. Convert uppercase text to uppercase text.
2. Convert lowercase text to lowercase text.
3. Text in the format of currency and currency.
4. The filter filters a subset of the Array Based on the provided standard.
5. sort and sort basic arrays. Capital Filter

Add an upper-case filter to use the MPs queue expression. Here, an upper-case filter is added to print all student names in upper-case 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}}

Lower case Filter

Add a lower-case Filter Using the MPs queue expression. Add a lower-case filter to print the Student name with lower-case 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() | lowercase}}

Currency Filter

The expression of the number returned by the coin Filter Using the MPs queue. Here, we have added a filter for printing the cost of currency format.

Enter fees: <input type="text" ng-model="student.fees">fees: {{student.fees | currency}}

Filter

To display only the required topics, we use subjectName as the 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>

Sort Filter

To sort topics by TAG, we use orderBy tag.

Subject:

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

Example

The following example shows all the above filters.

TestAngularJS.html

The above is all the content of this article. I hope you will like it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.