【发布时间】:2016-11-24 11:52:45
【问题描述】:
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 或值
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);
是否有任何东西阻止对浏览器中的页面内容进行任何更改?如何为这个 Ionic Android 应用使用简单的 JavaScript 更改 DOM 内容?
【问题讨论】:
标签: android angularjs cordova ionic-framework