I am creating a website with angular 2 in simple javascript and everything that works in the browser, but when I try to create a phonegapp application or use it using the Phonegap Mobile application, it does not work.
In index.html, I have:
<body>
<app>Loading app...</app>
<script src="libs/angular/2.0.0-beta.3/angular2-polyfills.js"></script>
<script src="libs/angular/2.0.0-beta.3/Rx.umd.js"></script>
<script src="libs/angular/2.0.0-beta.3/angular2-all.umd.js"></script>
<script src='app/services.build.js'></script>
<script src='app/components.build.js'></script>
<script src='app/app.component.js'></script>
<script src='app/main.js'></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript">
phonegapApp.initialize();
</script>
</body>
And on main.js I have:
var phonegapApp = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
ng.platform.browser.bootstrap(AppComponent,[
ng.router.ROUTER_PROVIDERS,
new ng.core.Provider(ng.router.LocationStrategy, {useClass: ng.router.HashLocationStrategy})
]);
}
};
So, I turn it on ng.platform.browser.bootstrapwhen the device is ready. (Also tried with document.addEventListener('DOMContentLoaded', function() {...}, but with the same result.
All that I can see. Loading ... this is <app>Loading...</app>not interpreted by angular.
Do you have any ideas what I should change to work? Thanks.
source
share