2017-09-23 74 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'; 

,進口增加他們。

相關問題