Sorting Data using ANGULARJS filtering

Source: Internet
Author: User

Look at the code below.

Scope. person = [{' id ': 1, ' name ': ' Xiao Zhang ', ' age ': 18},{' id ': 2, ' name ': ' Tom ', ' age ': 19},{' id ': 3, ' name ': ' Zhang San ', ' age ': 19},{' id ': 4, ' Name ': ' Xiaoming ', ' Age ': 17}];

Here is an array of objects, written in the Angularjs controller, that can be sorted and filtered when it is displayed on the page.

<table><tr><th> number </th><th> name </th><th> age </TH></TR><TR Ng-repeat= "Per in person | Orderby:[' age ', ' id ' | filter:{' age ': ' + ' ' ><td>{{per.id}}</td><td>{{per[' name ']}}</td><td>{{per.age} }</td></tr></table>

There is a table on which the person in the table is traversed, which can be sorted when traversing, and can be filtered.

The order of a single sort without curly braces, write ' age ' directly, for example:

ORDER BY: ' Age ', so that it can be arranged ascending, if it is reversed words: ' Age ': true, you can reverse.

Filter (filter) can be filtered data, can also be directly written as filter: ' 18 ', this can be blurred search. The relevant 18 of the number can be searched out, if the precise search, you can directly specify the corresponding field.

This article is from the "Music" blog, be sure to keep this source http://boysmusic.blog.51cto.com/9398683/1761948

Sorting Data using ANGULARJS filtering

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.