无法绑定到' zIndex'因为它不是'ng2-downdown-menu'的已知属性。

时间:2018-05-06 06:24:59

标签: angular

我的项目昨天工作正常。当我在早上开始运行时,它给了我这个错误。

If 'ng2-dropdown-menu' is an Angular component and it has 'zIndex' input, then verify that it is part of this module.
2. If 'ng2-dropdown-menu' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("namicUpdate">
    <ng2-dropdown-menu [focusFirstElement]="focusFirstElement"
                       [ERROR ->][zIndex]="zIndex"
                       [appendToBody]="appendToBody"
                       [offset"): ng:///TagInputModule/TagInputDropdown.html@2:23
    at syntaxError (compiler.es5.js:1694)
    at TemplateParser.parse (compiler.es5.js:12791)
    at JitCompiler._compileTemplate (compiler.es5.js:26994)
    at compiler.es5.js:26913
    at Set.forEach (<anonymous>)
    at JitCompiler._compileComponents (compiler.es5.js:26913)
    at compiler.es5.js:26800
    at Object.then (compiler.es5.js:1683)
    at JitCompiler._compileModuleAndComponents (compiler.es5.js:26799)
    at JitCompiler.compileModuleAsync (compiler.es5.js:26728)

ng2-dropdown-menu位于https://github.com/benfoley/angular2-tag-input包中。

提前致谢。

2 个答案:

答案 0 :(得分:0)

您需要导入{ Ng2DropdownModule }

import { Ng2DropdownModule } from 'ng2-material-dropdown';

@NgModule({
    imports: [
        Ng2DropdownModule
    ],

也在你需要做的组件中,

import { Ng2Dropdown, Ng2MenuItem } from 'ng2-material-dropdown';

还添加输入,

@Input() public zIndex = new defaults().zIndex;

还要升级您的包 ngx-chips

答案 1 :(得分:0)

该组件没有名为zIndex的输入,因此无效。

如果您只是尝试设置z索引CSS属性,则可以使用:

 <ng2-dropdown-menu [style.zIndex]="zIndex"></ng2-dropdown-menu>