Ionic framework forum === The most active framework.!!
Where can i read about $ionicPlatform.ready() in doc or somewhere else?
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.Platform.detect();
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) {
ionic.Platform.ready(function(){
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
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
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
ionic.Platform.ready(function(){
console.log('ionic platform ready');
});
and
$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