Open ghost opened 9 years ago
Did you fix this? I just moved db initialization to ui routers resolve and i got the same loop error.
As described in the readme, the app must wait for the deviceready
event before attempting to open the db.
I was just reading about this infinite digest loop, and it seems that there is a bug when using $stateProvider and $urlRouterProvider.otherwise. But you are right i totally forgot about this plugin depending on deviceready.
I am trying to work out if I am approaching this the wrong way or it is a bug.
Using angularjs with ui-router, I am making an SQLlite call within the resolve part of the ui-router state declaration so the data needed from the DB is available to my view before it loads.
I have made three tests to probe the issue. The first returns simple synchronous data. The second returns asynchronous data using angular's built in $http method. The last does the same using cordova SQLlite but fails and causes an infinite digest loop.
Can you shed any light on what the issue might be as I have tried all the sensible approaches I can think of the address this?
02-04 13:00:34.310: D/CordovaLog(11304): file:///android_asset/www/lib/ionic/js/ionic.bundle.js: Line 19387 : Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! 02-04 13:00:34.280: D/CordovaLog(11304): Watchers fired in the last 5 iterations: [] 02-04 13:00:34.280: D/CordovaLog(11304): http://errors.angularjs.org/1.3.6/$rootScope/infdig?p0=10&p1=%5B%5D
The code I am using is as follows:
state:
controller:
angular.module('starter.controllers').controller('MenuCtrl', function($scope, simpleObj, promiseObj, sqliteTest) {
});