$ionicPlatform.ready not firing

Hi,

as specified in the title, $ionicPlatform.ready is not firing. My architecture is a bit more complex than the sample ones (such as “tabs”), since I’m using require.js (it’s because the angular-ionic app will be deployed on a server for Desktop browser and it will be a huge app).

However, if I put the standard listener at the exact same place in the code, it fires as expected:

document.addEventListener(
    "deviceready", 
    function() {
        console.log("device is now ready");
    },
    false
);

1- is there any reason why it’s not working (because of require.js) or is it just a bug ?
2- is $ionicPlatform.ready any different of the standard deviceready listener, i.e. is it doing anything else or can it be superseded completely by the standard listener?

Thanks!

Most likely because of require.js I’d suggest not using require as it does mess with how ionic and angular load.

Also, keep in mind that we don’t aim to work 100% cross browser, as we’re more geared towards mobile.

the application will be huge (i.e. with lots of controllers) and since the application won’t be deployed exclusively as an iOS app (but also run normally on a desktop computer), require.js is so far (AFAIK) the only possibility for resolving controllers. It should only support Chrome (as Desktop browser) so cross browser compatibility is likely not an issue for me.

But if $ionicPlatform.ready has no “black magic” beyond the standard “deviceready” event, I will simply use the standard one.

$ionicPlatform.ready is an abstraction of ionic.platform.ready which just makes sure cordova is ready.

If your on a desktop, it makes sense that device ready isn’t firing since you don’t have cordova.
Another option to check out is browserify, which should play well with everything.

The parenthesis around the desktop development was just for justifying the use of require.js (and for simplification I’m using a similar architecture).

But no, I’m testing right now on the iOS simulator, and the ionic event doesn’t get fired (while the standard one does).

Any hint here?

I’m facing the same problem, not getting called $ionicPlatform.ready() on app launch only on iOS device, however I don’t think it’s anything related with require.js, because I’m not using it.

3 Likes

I am facing the same problem. How did you solved this issue?

1 Like

Do you have the code in plunkr ?