1
This is my edited plunker from AngularJS' ordering example.排序是好的,直到我定期更新聯繫人列表的代碼添加一個新人。新人將不會在列表中重新排序,而是始終將用戶添加到底部。當需要添加新用戶時,我需要列表重新排序。有沒有辦法做到這一點?AngularJS:插入新項目後重新排列列表
實際上,這就是我用來創建新的人,從角排序機制,其餘的人留下的一樣:
$scope.run_it = function() {
setTimeout($scope.run_it, 3000);
$scope.friends.push({name: 'New', phone: '000-0000', age: Math.floor((Math.random() * 100) + 1)});
$scope.$applyAsync();
};
setTimeout($scope.run_it, 3000);
看看使用$ q和承諾。 – lintmouse
也有棱角有一個特殊的'$超時'提供商 –