$ionicPlatform.ready does not fire on initial load on a device


#1

I have an $ionicPlatform.ready() callback set up in a controller, with the intention of using a cordova plugin once the device is ready. Unfortunately it looks like the callback does not get fired when starting the application initially.

If I navigate away from that state and back, it works. If I wrap the .ready() call in a $timeout or setTimeout of 1.5 seconds it works (any lower and it doesn’t fire). If I manually add an event listener for deviceready it works as well.

I tried looking at the source but nothing really stood out to me. I wonder if there’s some sort of edge case where the callback list is being emptied before the deviceready trigger has a chance to run through them. That’s just a shot in the dark, though.

Any help would be appreciated!


#2

hi, i have experienced similar odd behaviour and trying to track down the problem - I can see you have added an issue https://github.com/driftyco/ionic/issues/1693

did you put together an example?

//

pelle