【发布时间】:2019-03-07 23:08:22
【问题描述】:
在从 angular6 初始化下拉菜单时,它抛出了一个错误
ERROR TypeError: Cannot set property 'tabIndex' of null
at n.value (materialize.min.js:6)
at new n (materialize.min.js:6)
at Function.value (materialize.min.js:6)
at Function.value (materialize.min.js:6)
at NavHeaderComponent.push../src/app/components/headers/nav-header/nav-header.component.ts.NavHeaderComponent.ngOnInit (nav-header.component.ts:24)
at checkAndUpdateDirectiveInline (core.js:9250)
at checkAndUpdateNodeInline (core.js:10514)
at checkAndUpdateNode (core.js:10476)
at debugCheckAndUpdateNode (core.js:11109)
at debugCheckDirectivesFn (core.js:11069)
下面是我用来初始化它的代码,
ngOnInit() {
const elems = document.querySelectorAll('.dropdown-trigger');
const instances = M.Dropdown.init(elems);
}
【问题讨论】:
标签: angular6 materialize