Syncfusion TreeGrid + Angular 11 "Error: inject() must be called from an injection context"
Syncfusion TreeGrid + Angular 11 "Error: inject() must be called from an injection context"
我想在我的 Angular 解决方案中使用 Syncfusion TreeGrid,但是当我导入模块并将其添加到组件时,出现以下错误:
core.js:6210 ERROR Error: Uncaught (in promise): Error: inject() must be called from an injection context
Error: inject() must be called from an injection context
at injectInjectorOnly (core.js:4708)
at ɵɵinject (core.js:4718)
at Module.ɵɵdirectiveInject (core.js:14619)
at NodeInjectorFactory.TreeGridComponent_Factory [as factory] (ej2-angular-treegrid.js:493)
at getNodeInjectable (core.js:3596)
at instantiateAllDirectives (core.js:10280)
at createDirectivesInstances (core.js:9629)
at ɵɵelementStart (core.js:14837)
at Module.ɵɵelement (core.js:14888)
at TreeDemoComponent_Template (tree-demo.component.html:9)
at resolvePromise (zone-evergreen.js:1213)
at resolvePromise (zone-evergreen.js:1167)
at zone-evergreen.js:1279
at ZoneDelegate.invokeTask (zone-evergreen.js:406)
at Object.onInvokeTask (core.js:28540)
at ZoneDelegate.invokeTask (zone-evergreen.js:405)
at Zone.runTask (zone-evergreen.js:178)
我确定我的项目配置没有问题,因为尝试 run Sync fusion example.
时也会发生同样的情况
基于以下 Angular 版本:
Angular CLI: 11.2.6
Node: 15.5.0
OS: win32 x64
Package Version
@angular-devkit/architect 0.1102.6 (cli-only)
@angular-devkit/core 11.2.6 (cli-only)
@angular-devkit/schematics 11.2.6 (cli-only)
@schematics/angular 11.2.6 (cli-only)
@schematics/update 0.1102.6 (cli-only)
我们想通知您,目前 Syncfusion EJ1 组件不支持 Angular11。我们只支持到 Angular8。但是,我们已经记录了反馈以提供支持for Angular 9. 你可以从下面跟踪它的状态 link.
意见反馈: https://www.syncfusion.com/feedback/12334/provide-angular-9-support-for-ej1-components
但是,由于我们已经列出了一些主要功能,我们无法立即实施此支持。我们将实现这一点并将其包含在我们即将发布的任何版本中。请根据客户需求对该功能进行投票,我们将在即将发布的路线图中优先考虑这些功能。
我们想推荐我们的 EJ2 TreeGrid 组件,它支持 Angular11。要了解有关 EJ2-TreeGrid 的更多信息,请从下面的 links 中找到在线文档和示例。
文档: https://ej2.syncfusion.com/angular/documentation/treegrid/getting-started/
样本: https://ej2.syncfusion.com/angular/demos/#/material/treegrid/treegrid-overview
如果通过在 tsconfig.app.json
中为 compilerOptions 添加以下“路径”条目找到临时工作区
"paths": {
"@angular/*": [
"./node_modules/@angular/*"
]
}
我想在我的 Angular 解决方案中使用 Syncfusion TreeGrid,但是当我导入模块并将其添加到组件时,出现以下错误:
core.js:6210 ERROR Error: Uncaught (in promise): Error: inject() must be called from an injection context
Error: inject() must be called from an injection context
at injectInjectorOnly (core.js:4708)
at ɵɵinject (core.js:4718)
at Module.ɵɵdirectiveInject (core.js:14619)
at NodeInjectorFactory.TreeGridComponent_Factory [as factory] (ej2-angular-treegrid.js:493)
at getNodeInjectable (core.js:3596)
at instantiateAllDirectives (core.js:10280)
at createDirectivesInstances (core.js:9629)
at ɵɵelementStart (core.js:14837)
at Module.ɵɵelement (core.js:14888)
at TreeDemoComponent_Template (tree-demo.component.html:9)
at resolvePromise (zone-evergreen.js:1213)
at resolvePromise (zone-evergreen.js:1167)
at zone-evergreen.js:1279
at ZoneDelegate.invokeTask (zone-evergreen.js:406)
at Object.onInvokeTask (core.js:28540)
at ZoneDelegate.invokeTask (zone-evergreen.js:405)
at Zone.runTask (zone-evergreen.js:178)
我确定我的项目配置没有问题,因为尝试 run Sync fusion example.
时也会发生同样的情况基于以下 Angular 版本:
Angular CLI: 11.2.6
Node: 15.5.0
OS: win32 x64
Package Version
@angular-devkit/architect 0.1102.6 (cli-only)
@angular-devkit/core 11.2.6 (cli-only)
@angular-devkit/schematics 11.2.6 (cli-only)
@schematics/angular 11.2.6 (cli-only)
@schematics/update 0.1102.6 (cli-only)
我们想通知您,目前 Syncfusion EJ1 组件不支持 Angular11。我们只支持到 Angular8。但是,我们已经记录了反馈以提供支持for Angular 9. 你可以从下面跟踪它的状态 link.
意见反馈: https://www.syncfusion.com/feedback/12334/provide-angular-9-support-for-ej1-components
但是,由于我们已经列出了一些主要功能,我们无法立即实施此支持。我们将实现这一点并将其包含在我们即将发布的任何版本中。请根据客户需求对该功能进行投票,我们将在即将发布的路线图中优先考虑这些功能。
我们想推荐我们的 EJ2 TreeGrid 组件,它支持 Angular11。要了解有关 EJ2-TreeGrid 的更多信息,请从下面的 links 中找到在线文档和示例。
文档: https://ej2.syncfusion.com/angular/documentation/treegrid/getting-started/
样本: https://ej2.syncfusion.com/angular/demos/#/material/treegrid/treegrid-overview
如果通过在 tsconfig.app.json
中为 compilerOptions 添加以下“路径”条目找到临时工作区 "paths": {
"@angular/*": [
"./node_modules/@angular/*"
]
}