2014-07-09 2 views
0

json에서 like_count으로 내 반복을 주문하려면 어떻게해야합니까?Ng-repeat orderBy 값

나는 그에게 배쉬를 주었지만 나는 분명히 뭔가를 놓치고있다.

{ 
    "image_url" : "bde2cca8323d098edf43389119af7748.jpg", 
    "title" : "This is the title", 
    "like_count" : "15", 
    "creator" : { 
    "profile_img" : "john-doe.jpg", 
    "username" : "JD", 
    "url" : "/John-Doe", 
    "first_name" : "John", 
    "last_name" : "Doe", 
    "location" : "Sydney, Australia" 
    } 
}, { 
    "image_url" : "bjk234823d3232345343.jpg", 
    "title" : "This is the title", 
    "like_count" : "89", 
    "creator" : { 
    "profile_img" : "Jane-doe.jpg", 
    "username" : "JD", 
    "url" : "/Jane-Doe", 
    "first_name" : "Jane", 
    "last_name" : "Doe", 
    "location" : "Melbourne, Australia" 
    } 
} 
+3

합니까하지'해 orderBy : 'like_count'' 작업을

이 반복

item(ng-repeat="item in items | limitTo:3 | orderBy:like_count) 

이 데이터 구조입니다? – geoand

+0

문자열 값으로 정렬합니까? –

+0

'orderBy : '- like_count''는 완벽하게 작동합니다! – Daimz

답변

0

이 시도 ..

ng-repeat="item in items | limitTo:3 | orderBy:'like_count' 
+0

그건 그냥 의견의 사본 :) – geoand

+0

나는 그것이 정확하다고 생각 ... – parthicool05

+0

정확성 문제가 아닙니다! 그것은 맞습니다,하지만 당신은 방금 OP가 그것이 맞았다 고 언급 한 후에 내가 코멘트에서 말한 것을 복사했습니다! 속이려고하는 것 같아. :) – geoand