Order not working in angularjs

The order of work doesn't work for angularjs

<div class="friendprofile" ng-repeat="like in likePages| filter:likePages.pagename|orderBy:'likePages.pagename'">
    <img ng-src="{{like.pageimg}}">
    <span><a ng-href="#">{{like.pagename}}</a> </span>
</div>

      

+3


source to share


1 answer


I think this is enough if you use

orderBy:'pagename'

      

The predicate is a property of the iterator. In your case it will be orderedlike['pagename']



Example: http://plnkr.co/edit/2bXWUadA2Lb8zhAXnnlp?p=preview

A predicate used by the comparator to determine the order of elements.

Can be one of:

function : Getter function. The result of this function will be sorted using the <, =,> operator.

string : Angular expression that evaluates a custom object, for example "name" to sort by property called "name". Optionally prefixed with + or - to control ascending or descending sort order (for example, + name or -name).

Array : An array of function or string predicates. The first predicate in an array is used for sorting, but when two elements are equivalent, the next predicate is used.

Source: https://docs.angularjs.org/api/ng/filter/orderBy

+5


source







All Articles