getOrCreateInjectable (core.js:4079)...but app-data.service.ts:36只是一个函数的结尾this.spinner.off(spinnerName)), } // <--------- this is the 36. lineProxyService来自ddata-core包,但这是构造函数instance);
/
使用JitCompilerFactory并在运行时编译组件是有效的(例如,参见此处:),但注入到动态组件中不会:const metadatarender the component using Component Factory如果没有组件类构造函数中的DI (上面的#2),这一切都很好,但是尝试注入原因:
core.js:6210错误:
在Angular 11中测试组件时出现错误,但我不确定原因。This constructor is not compatible with Angular Dependency Injection because its dependency at index/node_modules/@angular/core/bundles/core.umd.js:5098:15)
at NodeInjectorFactory.factory (..\../node_modules
我在我的登录页面中导入一个服务,但是当它给我这个错误时,我的服务文件中有所有的装饰器,我在我的应用模块中有所有正确的导入。但我不知道为什么这个错误还会出现。我一直以同样的方式导入服务,但我不知道它到底需要什么才能将该服务注入组件中。Uncaught (in promise): Error: This constructor is not compatible with Angular Dependency Injection because5.1.1
@angular-devkit/bui
我是第一次接触angular/js/ts,我正在尝试弄清楚在angular中依赖注入是如何工作的。到目前为止,很多事情都很清楚,但我不明白angular如何调用组件构造函数,以及如何注入依赖关系,而不知道它们在构造函数定义中的定义顺序。 只是为了有个背景。以这个简单的Angular.io getting started example修改为例。