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