zl程序教程

您现在的位置是:首页 >  其它

当前栏目

No injector for custom defined data type的解决办法

for Data 解决办法 No type Custom defined
2023-09-14 09:04:03 时间

“message”: "Can’t resolve all parameters for AppComponent in c:/Code/SPA/mystore/src/app/app.component.ts

‘DebugConfig’ only refers to a type, but is being used as a value here.

解决办法

在app module里定义一个abstract class:

在NgModule的providers里定义这个injectable objects:

此时在Component里就可以注入DebugConfig了:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":