无法绑定到' customClass'因为它不是树视图的已知属性。

时间:2017-02-08 06:54:28

标签: angular

我使用https://www.npmjs.com/package/ng2-tree-view提供的指南安装了ng2 treeview包。现在,我在运行代码时遇到以下错误。 这是错误:

      Unhandled Promise rejection: Template parse errors:
      Can't bind to 'customClass' since it isn't a known property of 'tree-view'.
      1. If 'tree-view' is an Angular component and it has 'customClass' input, then verify that it is part of this module.
      2. If 'tree-view' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
       ("
  <tree-view (onNodeSelected)="selectedNode($event)" [ERROR ->][customClass]="'my-custom-class'" [nodes]="sampleNodes"></tree-view>
"): ProjetcEditComponent@1:57
    Can't bind to 'nodes' since it isn't a known property of 'tree-view'.
      1. If 'tree-view' is an Angular component and it has 'nodes' input, then verify that it is part of this module.
      2. If 'tree-view' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
     ("
  <tree-view (onNodeSelected)="selectedNode($event)" [customClass]="'my-custom-class'" [ERROR ->][nodes]="sampleNodes"></tree-view>
"): ProjetcEditComponent@1:91
    'tree-view' is not a known element:
   1. If 'tree-view' is an Angular component, then verify that it is part of this module.
   2. If 'tree-view' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("

enter image description here

1 个答案:

答案 0 :(得分:0)

我刚删除了&#34;节点:&#34;从代码(在构造函数内)和它的工作正常。