即使导入CalendarModule之后,“ p-calendar”也不是已知的元素错误

时间:2018-07-29 06:38:33

标签: angular primeng

即使在导入CalendarModule之后,在angular2中使用p-calendar时,我也遇到了错误。

从“ ../../../vendor/primeng/components/calendar/calendar”中导入{CalendarModule};

    Uncaught Error: Template parse errors:
'p-calendar' is not a known element:
1. If 'p-calendar' is an Angular component, 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. ("
    <div>
        Calendar
        [ERROR ->]<p-calendar [(ngModel)]="todaysDate"></p-calendar>
    </div>

Calendar error

1 个答案:

答案 0 :(得分:0)

好像您错过了在应用程序中导入CalenderModule一样。您必须从CalendarModule库中将AppModule内的primeng导入imports的{​​{1}}中。

AppModule