2017-09-23 2 views
0

Wenn ich diesen Fehler beim Hinzufügen eines Dropdown-Menüs 'primeNG' zu 'userform.component.ts' hinzufügen möchte, habe ich auf diesen Wert verwiesen Erfolg, wie ich dieses Update bereits immplemented: primeng dropdown component error ('p-dropdown' is not a known element)Kann nicht an 'Optionen' gebunden werden, da es keine bekannte Eigenschaft von 'p-dropdown' ist

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

Dank!

+0

Sie haben das UserformModule nicht in das AppModule importiert. –

Antwort

0

Die Angulars Fehlermeldung ist ziemlich verbos und wenn Sie es sorgfältig lesen, können Sie das Problem auf einfache Weise selbst lösen.

Der erste Artikel gilt für Ihren Fall: Sie wissen, dass p-dropdown eine eckige Komponente ist und Sie wissen, dass es options Eingang hat. Die Fehlermeldung fordert Sie auf, zu überprüfen, ob es ein Teil des Moduls ist, in dem Sie es verwenden. Und tatsächlich sind Sie trying to use eine Komponente without importng the module wich exports it.

0

Dieser Fehler tritt normalerweise auf, wenn Sie einige Importe verpasst haben. Bitte fügen Sie diese Zeile, wenn sie fehlt:

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

und fügen Sie sie auch bei den Importen.

Verwandte Themen