我需要在ng-repeat中订购JSON的帮助。我想通过item.id来订购我的数据(从最高到最低)。我试过很多的技巧,是在互联网,但也许我只是做一些错误的,因为他们都不是为我工作...我的代码:在Angular(Ionic)中订购JSON数据
$http.get('http://jastrzebieonline.pl/drogi/data/najnowsze.php')
.success(function(res){
$scope.news = res;
console.log("Ok");
})
.error(function(data, status) {
console.log("Error");
})
<div ng-repeat="item in news">
<a href="{{ item.id }}">
<img src="{{ item.image }}">
<h2>{{ item.title }}</h2>
<p>{{ item.date }}</p>
<p>{{ item.text }}</p>
</div>
</a>
</div>
确保您的 '身份证' 属性的类型为整数。那么只要在新闻| orderBy:' - id'''' – devqon