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
也有棱角有一个特殊的'$超时'提供商 –