angular.module("app.categories").controller("CategoryController", t), t.$inject = ["$scope", "$stateParams", "$state", "categoryManager"]
angular.module("app", ["ionic", ["app.home","app.products",...]);
angular.module("app").run(["$templateCache", function(t) {
t.put("app/scripts/about/about.html", '<ion- view>.....'),t.put("app/scripts/home/block.html", '<div>....')}]); //this is how the page content is loaded
我在瀏覽器中使用Ionic(根目錄中的'Ionic serve')運行此應用程序。我無法在已加載內容的頁面上運行基本JavaScript。如果DOMContentLoaded超時被稱爲後,該元素回升,但運行以下僅操縱元素的ID,而不是HTML或價值無法操作Ionic Android應用程序的DOM內容
setTimeout(function(){
document.addEventListener('DOMContentLoaded',function(){
document.getElementById('customBox').id = 'changed'; //to test, id changes
document.getElementById('customBox').innerHtml = '<h1> test </h1>'; //does not change anything, no errors in console
document.getElementById('customBox').text= '<h1> test </h1>'; //does not change anything, no errors in console
document.getElementById('customBox').html= '<h1> test </h1>'; //does not change anything, no errors in console
});
},2000);
有沒有什麼問題,導致任何改變網頁內容中瀏覽器嗎?如何使用簡單的JavaScript爲此Ionic Android應用程序對DOM內容進行更改?
與$超時嘗試,對於ID的變化,這是隻是爲了測試,至少有一些相關的元素髮生了變化,即使在我刪除id變更之後也會發生同樣的情況,其餘部分不會改變任何內容 –