【问题标题】:PrimeNG error ConfirmationService has not been processed correctly by ngcc, or is not compatible with Angular IvyPrimeNG 错误 ConfirmationService 没有被 ngcc 正确处理,或者与 Angular Ivy 不兼容
【发布时间】:2021-05-26 22:43:42
【问题描述】:

我正在使用 PrimeNG 11,角度为 11,按照此配置:

  "dependencies": {
"@angular/animations": "^11.2.2",
"@angular/cdk": "^11.2.1",
"@angular/common": "^11.2.2",
"@angular/compiler": "^11.2.2",
"@angular/core": "^11.2.2",
"@angular/forms": "^11.2.2",
"@angular/platform-browser": "^11.2.2",
"@angular/platform-browser-dynamic": "^11.2.2",
"@angular/router": "^11.2.2",
"@auth0/angular-jwt": "^5.0.2",
"bootstrap": "^5.0.0-beta2",
"primeicons": "^4.1.0",
"primeng": "^11.2.3",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"typescript-map": "^0.1.0",
"zone.js": "^0.10.3"  }

导入模块和服务以使用确认对话框组件后出现错误

This likely means that the library (primeng/api) which declares ConfirmationService has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is a

可用,如果可用,请更新。还可以考虑与图书馆的作者核实,看看图书馆是否应该与 Ivy 兼容。

导入行

import {ConfirmDialogModule} from 'primeng/confirmdialog'; import {ConfirmationService} from 'primeng/api';

我试过了

  1. 删除节点模块并运行 npm update
  2. 将此行添加到 package.json 中的脚本 ["postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"]

这些都不适合我。

有人可以帮忙吗?

【问题讨论】:

    标签: angular primeng


    【解决方案1】:

    我发现我正在导入 ConfirmationService 而不是将其添加到 providers。将其添加到提供程序后,它工作得很好。该错误消息完全具有误导性。

    【讨论】:

      猜你喜欢
      • 2020-10-08
      • 2020-08-24
      • 1970-01-01
      • 1970-01-01
      • 2019-08-03
      • 2020-06-27
      • 2023-01-31
      • 2021-06-29
      • 2021-01-16
      相关资源
      最近更新 更多