2017-09-23 75 views
0

尝试将primeNG下拉列表添加到userform.component.ts时出现此错误,我引用了该选项,但没有引用该选项无济于事,因为我已经有这个修复immplemented:primeng dropdown component error ('p-dropdown' is not a known element)由于它不是“p-dropdown”的已知属性,因此无法绑定到“选项”

Uncaught Error: Template parse errors: 
Can't bind to 'options' since it isn't a known property of 'p-dropdown'. 
1. If 'p-dropdown' is an Angular component and it has 'options' input, then verify that it is part of this module. 
2. If 'p-dropdown' 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. ("<p-dropdown [ERROR ->][options] = "technologies" [autoWidth] = "false" id = "technologies"></p-dropdown> 

GIT REPO:https://github.com/BillyCharter87/Tech-O-Dex

谢谢!

+0

您没有在AppModule内导入UserformModule。 –

回答

0

Angular的错误信息非常复杂,如果您仔细阅读,可以轻松地自行解决问题。

第一项适用于您的案例:您知道p-dropdown是一个角度组件,并且您知道它具有options输入。错误消息会要求您确认它是您使用它的模块的一部分。实际上,您是trying to use的组件without importng the module wich exports it

0

通常,当您错过某些导入时会发生此错误。 如有缺少添加这些行:

import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 
import { DropdownModule } from 'primeng/primeng'; 

,进口增加他们。

相关问题