我正在使用 Angular 的剑道网格。升级到 Angular 14 后,使用 package.json 中的以下包在 kendo 网格中加载数据时看到以下错误。如果这是软件包版本问题,请告诉我。
TypeError: Cannot read properties of undefined (reading 'add')
at ListComponent.ngOnInit (index.js:11229:28)
at callHook (core.mjs:2491:22)
at callHooks (core.mjs:2460:17)
at executeInitAndCheckHooks (core.mjs:2411:9)
at selectIndexInternal (core.mjs:9854:17)
at Module.ɵɵadvance (core.mjs:9837:5)
at GridComponent_ng_template_5_Template (index.js:154:5)
at executeTemplate (core.mjs:12113:9)
at refreshView (core.mjs:11998:13)
at refreshEmbeddedViews (core.mjs:13026
Package.json -
"@progress/kendo-angular-buttons": "latest",
"@progress/kendo-angular-common": "latest",
"@progress/kendo-angular-dateinputs": "latest",
"@progress/kendo-angular-dropdowns": "latest",
"@progress/kendo-angular-excel-export": "latest",
"@progress/kendo-angular-grid": "latest",
"@progress/kendo-angular-inputs": "latest",
"@progress/kendo-angular-intl": "latest",
"@progress/kendo-angular-l10n": "latest",
"@progress/kendo-angular-layout": "latest",
"@progress/kendo-angular-pdf-export": "latest",
"@progress/kendo-angular-popup": "latest",
"@progress/kendo-angular-tooltip": "latest",
"@progress/kendo-angular-treeview": "latest",
"@progress/kendo-angular-upload": "latest",
"@progress/kendo-data-query": "latest",
"@progress/kendo-drawing": "latest",
"@progress/kendo-file-saver": "latest",
"@progress/kendo-theme-bootstrap": "latest",
"@progress/kendo-theme-default": "latest",
"rxjs": "^7.4.0",
"rxjs-compat": "^6.2.2",
错误:
TypeError: Cannot read properties of undefined (reading 'add') at ListComponent.ngOnInit (index.js:11229:28) ...
说明出了什么问题。只需转到 ListComponent
的 ngOnInit
方法并检查何时使用 add
(方法/属性)以及为什么它的“所有者”是 undefined
。升级后,某些流程或命名可能会发生变化并导致此类问题。