Platform Ready


I’m with a problem with $ionicPlatform.ready
When debugging the app on the google chrome, an alert is displayed.
But when I run the app on device, the alert isn’t displayed.

$ionicPlatform.ready(function () {

What I’m doing wrong ?

Can you please share your code sample ?



function ($ionicPlatform,
StartupService) {

$ionicPlatform.ready(function () {


How did you run the app on device ?

Just like this:

ionic build ios
and running from xcode

I had that problem also …

I saw this article

However, during the app deployment testing, the ionic platform was not
yet ready. In that circumstance it turns out the first callback function
passed to $ionicPlatform.ready() wins and is called back when the
platform really is ready. Unfortunately, other callbacks passed to the
function are silently ignored.

So in order to make it work I use something like

var isWebView   = ionic.Platform.isWebView(); 
        if(isWebView === true) {
            document.addEventListener('deviceready', function () {
             }, false);
        } else {
            $ionicPlatform.ready(function() {

So now it works in browser AND device …