Cordova + Angularjs + Device Ready

Manually bootstrap your Angular app:

Remove your ng-app attribute from your HTML code, so Angular doesn’t start itself.

Add something like this to you JavaScript code:

document.addEventListener("deviceready", function() {
    // retrieve the DOM element that had the ng-app attribute
    var domElement = document.getElementById(...) / document.querySelector(...);
    angular.bootstrap(domElement, ["angularAppName"]);
}, false);

Angular documentation for bootstrapping apps.

Leave a Comment