gpt4 book ai didi

angular - PrimeNG 报错 ConfirmationService has not been corrected by ngcc, or is not compatible with Angular Ivy

转载 作者:行者123 更新时间:2023-12-05 08:48:10 26 4
gpt4 key购买 nike

我根据此配置使用 Angular 为 11 的 PrimeNG 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"]

这些都不适合我。

有人可以帮忙吗?

最佳答案

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

关于angular - PrimeNG 报错 ConfirmationService has not been corrected by ngcc, or is not compatible with Angular Ivy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66353846/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com