即使在导入 CalendarModule 并将其添加到 AppModule 中的导入后,我也收到 'p-calendar' is not a known element 错误

I am getting 'p-calendar' is not a known element error even after importing CalendarModule and adding it to imports in AppModule

我收到 'p-calendar' is not a known element 错误,即使在导入 CalendarModule 并将其添加到 AppModule 中的导入后也是如此

浏览器控制台中的实际错误消息

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.

Dependencies list in my package.json
  "dependencies": {
    "@angular/animations": "~8.2.14",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/forms": "~8.2.14",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "bootstrap": "^4.4.1",
    "jquery": "^3.5.0",
    "primeicons": "^2.0.0",
    "primeng": "^9.0.5",
    "rxjs": "~6.4.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },

您是否也导入了 Commonmodule?它包含 ngModel

刚刚发现双向绑定需要FormsModule

import { FormsModule } from '@angular/forms';

也将它添加到@NgModule imports