如何通过我的json中的like_count
订购ng-repeat?
我给了它一个bash,但我显然遗漏了一些东西。
这是重复
item(ng-repeat="item in items | limitTo:3 | orderBy:like_count)
这是数据结构:
{
"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" : "bjk23482301232234112d3232345343.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"
}
}
答案 0 :(得分:0)
试试这个..
ng-repeat="item in items | limitTo:3 | orderBy:'like_count'