I am trying to load data from my SQLite DB before loading my view by using resolve when defining my state.
Currently
.state("menu", {
templateUrl: "templates/menu.html",
controller: "MenuCtrl",
url: "/menu",
resolve:{
simpleObj: function(){
return {value: 'simple!'};
},
promiseObj: function($cordovaSQLite){
query = "SELECT id FROM reports WHERE progress_status<2";
$cordovaSQLite.execute(db, query, []).then(function(res) {
var pendingList = [];
for (var i = 0; i < res.rows.length; i++) {
pendingList.push(res.rows.item(i).id);
}
return pendingList;
});
}
}
})
But this code gives me an infinite digest loop.
I normally have the DB execute code in a service (giving same result) but have moved inline for testing sake
Can anyone tell me how I might do this properly?