Ionic.Platform.ready is not ready


I am trying to detect that Cordova is ready so that I can start putting my device specific code.
So i am using the following and it doesn’t seem to work:-


all values are undefined… of course i am running on the device. and it is running from the function.

i suspected this could be a problem with cordova, not with ionic, so i tried to do it directly with Javascript and it worked fine:-
document.addEventListener(“deviceready”, onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the Cordova API
console.log(“Device is ready”);
var element = document.getElementById(‘deviceProperties’);

    element.innerHTML = 'Device Name: '     +     + '<br />' + 
                        'Device Cordova: '  + device.cordova + '<br />' + 
                        'Device Platform: ' + device.platform + '<br />' + 
                        'Device UUID: '     + device.uuid     + '<br />' + 
                        'Device Model: '    + device.model     + '<br />' + 
                        'Device Version: '  + device.version  + '<br />';

This sounds like a really basic functionality in ionic Framework, i am not sure why it doesn’t work?

Yeo ionic generator & cordova?

Where exactly are you putting that code? What version of Ionic are you using?

Here is how the sample apps (from Getting Started) use it:

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers'])

.run(function($ionicPlatform, $timeout) {
  $ionicPlatform.ready(function() {
    console.log('Platform ready!');

    if(window.StatusBar) {
      // org.apache.cordova.statusbar required

It seems maybe you’re using an old version of just using it wrong with ionic.Platform.ready. It needs to be $ionicPlatform.ready in the newer releases.


Calendee, thank you for the prompt response, I tested again this morning and my problem turned out to be completely different.
i am using the following to check the information:-


and it looks like console.log does not work very well in Cordova, i have to put it like this:-

console.log("cordova:" + ionic.Platform.isCordova()); 

otherwise, the information after the comma in the first statement will appear as empty.

That was misleading to me, and to you , i am sorry about that.

I am using the latest version 1.0.0 beta of ionic, and both $ionicPlatform and ionic.Platform are working now perfectly.
Note that if ionic.Platform should not be used in that case, it still appears in the documentation here:-

Best Regards,