无法绑定到 'options',因为它不是 'p-dropdown' 的已知 属性
Can't bind to 'options' since it isn't a known property of 'p-dropdown'
尝试将 primeNG 下拉列表添加到 userform.component.ts 时出现此错误,我已参考此但无济于事,因为我已经实施了此修复:
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 回购:https://github.com/BillyCharter87/Tech-O-Dex
谢谢!
Angular的错误信息相当冗长,如果你仔细阅读它,你可以很容易地自己解决问题。
第一项适用于您的情况:您知道 p-dropdown
是一个 Angular 组件并且您知道它有 options
输入。错误消息要求您确认它是您正在使用它的模块的一部分。实际上,您是 trying to use a component without importng the module wich exports it.
通常,当您错过某些导入时会出现此错误。
如果缺少,请添加这些行:
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { DropdownModule } from 'primeng/primeng';
并将它们也添加到导入中。
您可能正在另一个组件中使用 p-dropdown
,而您尚未在另一个组件的模块中导入 DropdownModule
。我犯了同样的错误,通过将 DropdownModule
放在 AppModule
以及特定组件的模块中得到解决。
只要确保你有这个设置:
@NgModule({
declarations: [YourComponent],
imports: [DropdownModule],
})
尝试将 primeNG 下拉列表添加到 userform.component.ts 时出现此错误,我已参考此但无济于事,因为我已经实施了此修复:
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 回购:https://github.com/BillyCharter87/Tech-O-Dex
谢谢!
Angular的错误信息相当冗长,如果你仔细阅读它,你可以很容易地自己解决问题。
第一项适用于您的情况:您知道 p-dropdown
是一个 Angular 组件并且您知道它有 options
输入。错误消息要求您确认它是您正在使用它的模块的一部分。实际上,您是 trying to use a component without importng the module wich exports it.
通常,当您错过某些导入时会出现此错误。 如果缺少,请添加这些行:
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { DropdownModule } from 'primeng/primeng';
并将它们也添加到导入中。
您可能正在另一个组件中使用 p-dropdown
,而您尚未在另一个组件的模块中导入 DropdownModule
。我犯了同样的错误,通过将 DropdownModule
放在 AppModule
以及特定组件的模块中得到解决。
只要确保你有这个设置:
@NgModule({
declarations: [YourComponent],
imports: [DropdownModule],
})