Open oulinhuao opened 6 years ago
Hi There, any fix to this.
I installed this plugin last night and it was working but getting the same problem above now. Not sure why?! Thanks
the CordovaHTTP.js that exposes angular module gets injected AFTER your app.js has been bootstrapped. You can view the order how files are loaded by injecting yourself in to IOS Webinspector.
In order to fix it, you could try to do manual bootstrapping after the files have loaded. See more info: https://docs.angularjs.org/guide/bootstrap#manual-initialization
Hi Chris,
I didn't have much success with the manual bootstrap but what did work for me was just commenting out cordovaHTTP in angular.module. The plugin works fine so all good :-) Thanks for reply
no problem.
For anyone else struggling & just to let you know-:
the best practice for ionic apps is to bootstrap your application manually. This ensures the dependencies are resolved in the correct order and avoids issues like these.
Here is an example how to manually bootstrap which works for web & phones:
<script>
angular.element(document).ready(function () {
if (window.cordova) {
document.addEventListener('deviceready', function () {
angular.bootstrap(document.body, ['ionicApp']);
}, false);
} else {
angular.bootstrap(document.body, ['ionicApp']);
}
});
</script>
It's a Ionic project. When I register cordovaHTTP in main module ,browser console that:
and my code is:
I can't use this plugin. Is there anything wrong with me?