Angular 启动组件错误的导入路径
我是Angular的新手,我遵循了教程并成功获得了结果。现在,我尝试按照说明添加日历组件-但无法获得正确的导入路径 这是它的样子 我得到以下错误:Angular 启动组件错误的导入路径,angular,typescript,primeng,Angular,Typescript,Primeng,我是Angular的新手,我遵循了教程并成功获得了结果。现在,我尝试按照说明添加日历组件-但无法获得正确的导入路径 这是它的样子 我得到以下错误: Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'p-calendar'. 1. If 'p-calendar' is an Angular component
Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'p-calendar'.
1. If 'p-calendar' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
2. If 'p-calendar' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
("<h1>PrimeNG Hello World</h1>
<p-calendar [ERROR ->][(ngModel)]="value"></p-calendar>
<input type="text" pInputText placeholder="Please enter your n"): UserAppComponent@1:16
at resolvePromise (zone.js:418)
at resolvePromise (zone.js:403)
at zone.js:451
at ZoneDelegate.invokeTask (zone.js:225)
at Zone.runTask (zone.js:125)
at drainMicroTaskQueue (zone.js:357)
at XMLHttpRequest.ZoneTask.invoke (zone.js:297)
我只是将路径替换为“日历/日历”本教程似乎过时了。你只需:
import { CalendarModule } from 'primeng/primeng';
在您的
@NgModule
中,它应该可以。您是否尝试过=>在您的@NgModule中导入:[CalendarModule],甚至在导出中导入:[CalendarModule]?谢谢-是的-它仍然是灰色的。。。不明白为什么…是的,嗯。。我试过。。。无法真正理解为什么它是灰色的app.component:删除导入的CalendarModule
,在app.module中添加CalendarModule
到imports
数组。谢谢,仍然是灰色的。。。这很奇怪,因为它在自动完成中找到了模块…所以它选择了它-然后它又变成灰色…Tbh,这真的很可疑,我想剩下的就是卸载底漆并重新安装它。现在它工作了-但线条仍然是灰色的。。为什么呢?
import {ConfirmationService, Message} from
"primeng/components/common/api";
import { CalendarModule } from 'primeng/primeng';