【发布时间】:2020-04-04 12:35:45
【问题描述】:
我想隐藏和创建由 AngularJS 加载的元素。
当我想执行我的 JS 函数时,DOM 没有完全加载。
问题:我的查询选择器无法检测到元素。而且我不想使用timeout,因为它取决于用户的网络。
我的代码:
app.controller('RootController', function($scope, $http, $filter) {
$scope.init = function() {
// NULL here, but after dom loaded in the chrome console I get an array of elements
console.log(document.querySelectorAll('table .actionslist'));
}
});
【问题讨论】:
-
您希望如何处理这些元素?也许有一个更角度的方式来达到同样的效果?
标签: angularjs