$ionicPlatform.ready() Where can i read about on doc?


Ionic framework forum === The most active framework.!!

Where can i read about $ionicPlatform.ready() in doc or somewhere else?


There isn’t a whole lot to it. If you go in the Ionic source could, you can see that it is just listening for the Cordova/phonegap deviceready event to fire.

  function onCordovaReady() {
    // the device is all set to go, init our own stuff then fire off our event
    ionic.Platform.isReady = true;
    ionic.trigger('platformready', { target: document });
    document.removeEventListener("deviceready", onCordovaReady, false);

This is in /ionic/js/utils/platform.js


Thank’s Calendee… I understand…


I just put together a platform docs page here: http://ionicframework.com/docs/angularjs/utils/platform/


I try to do a mix of your link and:

So i try:

angular.module('starter.controllers', ['ionic'])
.run(function(ionic) {
            console.log('platform ready');

But I have:
Uncaught Error: [$injector:modulerr]

What’s the best practise to call ionic.Platform.ready


Not sure about “best practice”, but I use an overall “app” controller and put it there:

angular.module('app.controllers').controller('AppController', [ '$scope', '$ionicPlatform', function($scope, $ionicPlatform){

    // Identify the country code for this device
    $ionicPlatform.ready(function() {

	    console.log('platform Ready!');



Not sure either for “best practice” but we use a factory (in a configuration Module with other constants defined)

.factory(‘configFactory’, [’$ionicPlatform’,
function($ionicPlatform) {

          $ionicPlatform.ready(function() {

          return $ionicPlatform.ready;



Funny that it’s called docs/angularjs/page but on that specific page you made @adam not a single word is spoken about the AngularJS service implementation, only the core Ionic javascript code :smile:

Of course any well-thinking human being is able to derive some information from that docs page, but the URL is kind of misleading; I was expecting AngularJS information there :wink:


I am using $ionicPlatform.ready() in my main controller and I am seeing inconsistent behavior, sometimes the app loads and other times it doesnt. It is as if the ready callback is not always called.

This is on IOS


Will be cleared up very soon with the new generated documentation.


not really sure what this response means? I read through the latest release notes and there was nothing specific that spoke to the issue I am seeing.


What I meant is we are working on source-generated documentation and are hoping to release it within the next few days. It will make everything much clearer.


Is there any difference between

    console.log('ionic platform ready');


$ionicPlatform.ready(function() {
    console.log('$ionicPlatform ready');


can I call function of first controller function from .run( onready function)


dont inject ionic in .run function