How to only use Dependencies in Controllers (E.g. NgCordova) when the App is ready?


My app uses ngCordova in one of the Controllers linked to my first page (ie. it is invoked when the first page is shown).

It seems to be the case that the app is trying to use ngCordova before it has been initialised - e.g. when the first page is shown I immediately try to locate the user’s location using:


this sometimes fails in my simulator and sometimes does not. If I write out to the debug console I can see that the controllers are firing before my

$ionicPlatform.ready(function() {

event. How do I tell the controllers not to be invoked until the platform is ready?


Hmm - I found this thread which discusses the problem is a fair bit of detail - When are the angular controller's loaded?

Will have to wrap my services in the $ionicPlatform.ready(function() { check I think