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变更之后也会发生同样的情况,其余部分不会改变任何内容 –