我在离子框架中使用ngcordova sqllite插件。 这是html部分
<ion-content padding="true" class="has-header" ng-controller="qtnController">
<div class="list list-inset">
<label class="item item-input">
<i class="icon ion-search placeholder-icon"></i>
<input type="search" placeholder="Search" ng-model="searchQuestion">
</label>
</div>
<div class="card" ng-repeat="i in reta track by i.id">
<div class="item item-divider">{{i.name | uppercase}}</div>
<div class="item item-text-wrap">Description : {{i.description}}</div>
<div class="item item-divider">Id : {{i.id}}</div>
</div>
这是js部分: -
modules.controller("qtnController", function($scope,$cordovaSQLite){
$scope.reta = [];
var query = "select id,name,questions,options,description from questionSet order by id desc";
db.transaction(function(){
$cordovaSQLite.execute(db,query).then(function(res){
if(res.rows.length > 0){
$scope.reta = res.rows;
}else{console.log("No results found");}
});
});
})
这一切都运行正常,但收到此错误
uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
将过滤器置于ng-repeat中会产生错误。
<div class="card" ng-repeat="i in reta track by i.id | repeat : searchQuestion">