2
在deviceready事件觸發後,有什麼方法可以在我的angular應用中設置$ rootScope變量?
var application = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, true);
},
// deviceready Event Handler
onDeviceReady: function() {
//set angular app $rootScope variable
}
};
這個應該可以的,試試看吧。謝謝。 –
你在哪裏寫這個? 我在index.js文件中有我的onDeviceReady事件,並且我在main.js中創建了我的angular應用程序模塊。那我應該複製一下嗎? – Laureant