我的問題是我想延遲angularjs中的ng-repeat結果。我的延遲過濾器代碼如下。使用過濾器延遲ng-repeat結果
<ul>
<li ng-repeat="phone in phones | filter:delay_filter">
<span>{{phone.name}}</span>
</li>
</ul>
<script>
var phonecatApp = angular.module('phonecatApp', ['ngMessages']);
phonecatApp.controller('PhoneListCtrl', function ($scope, $http, $scope) {
$scope.delay_filter=function(item){
alert(++$c);
x=setTimeout($scope.trf(),2200);
return item;
};};)
</script>
但這不起作用。搜索提供了即時結果。 我沒有在html中編寫控制器,我知道這一點。在我的代碼在那裏。那不是問題。請幫我解決這個問題
看看這是這樣的http://stackoverflow.com/questions/18238227/delay-an-angular-js-http-service – Jax
你試圖實現與延遲?如果這是爲了視覺上的延遲,ng-animate有一個錯誤,你可以使用這樣的東西。 – ajmajmajma
您是否需要延遲ng-repeat的顯示,或者是否需要延遲手機上的某種搜索/過濾器? –