- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
in a project using Intel xdk, Cordova, Ionic, it seems there is a problem with the deviceready event: it seems that code was executed before the device was ready. I think the problem is how I write my custom code: in a separated custom js file (where I stored all the js code using ionic) linked from the index.html file of the project.
My custom js file (where I put all my custom code, linked from index.html) starts with somethings like this:
var myApp = angular.module('myApp', ['ionic','ngCordova']);
(myApp matchs with the ng-app directive in index.html)
After, I configured $StateProvider, controller etc...
Is this the right way of using Intel XDK?
If yes, how Intel XDK environment can run my code after the cordova deviceready event?
Thanks in advance!
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Giovanni,
There are 2 ready events that are important and either one can finish first. The device needs to be ready and the DOM needs to be loaded.
Take a look at the following example where the app.Ready event ensures that both the DOM and device are ready and then triggers initEvent (where you can call your code):
Samples and Demos -> General -> HTML5 + Cordova (tab) -> Blank Cordova Starter App, particularly how the initEvents function is invoked after the app.Ready event occurs (look at www/js/app.js, www/js/init-app.js, and www/xdk/init-dev.js)
This sample is well-commented and hopefully will help you.
Pamela
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page