0
訂購ng-repeat中的項目後有些問題。用錯誤的索引點擊項目打開頁面後。 我的示例HTML代碼,打開的頁面中正確的是:
<div ng-repeat="item in items" ng-click="showPost($index)">{{item.title}}</div>
如果添加排序依據,顯示錯誤後指數:
<div ng-repeat="item in items | orderBy:'-title'" ng-click="showPost($index)">{{item.title}}</div>
而我的$範圍功能showPost():
$scope.showPost = function(index){
$rootScope.postContent = $scope.catItems[index];
$scope.ons.navigator.pushPage('post.html');
};