简体   繁体   中英

how to fix template parse error in angular?

I have used this library for my ionic project:

Error: Template parse errors:

Can't bind to 'topOrg' since it isn't a known property of 'ng2-org-chart'.

  1. If 'ng2-org-chart' is an Angular component and it has 'topOrg' input, then verify that it is part of this module.
  2. If 'ng2-org-chart' 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.
<ion-content padding>

  <ng2-org-chart [ERROR ->][topOrg]="topOrg"></ng2-org-chart>

</ion-content>

from ng:///AppModule/LineagePage.html@28:17

'ng2-org-chart' is not a known element:

  1. If 'ng2-org-chart' is an Angular component, then verify that it is part of this module.
  2. If 'ng2-org-chart' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
<ion-content padding>

  [ERROR ->]<ng2-org-chart [topOrg]="topOrg"></ng2-org-chart>

</ion-content>

from ng:///AppModule/LineagePage.html@28:2

'import { OrgChartModule } from 'ng2-org-chart'; statement in corresponding module should fix it and also change [topOrg] to [topEmployee] then verify. updated stackbitz - https://stackblitz.com/edit/angular-g6ypks?file=src/app/app.component.html (if you try to change topEmployee to toOrg where input is getting passed it doesnt work as you are using some existing npm package where input is being passed as 'topEmployee')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM