如何处理使用ngrx时遇到的错误消息: NullInjectorError R3InjectorError(AppModule)[StoreFeatureModule]
錯誤消息:
main.ts:12 NullInjectorError: R3InjectorError(AppModule)[StoreFeatureModule -> ReducerManager -> ReducerManager -> ReducerManager]:
NullInjectorError: No provider for ReducerManager!
at NullInjector.get (http://localhost:4200/vendor.js:8310:27)
at R3Injector.get (http://localhost:4200/vendor.js:22317:33)
at R3Injector.get (http://localhost:4200/vendor.js:22317:33)
at R3Injector.get (http://localhost:4200/vendor.js:22317:33)
at injectInjectorOnly (http://localhost:4200/vendor.js:8165:33)
at Module.??inject (http://localhost:4200/vendor.js:8175:57)
at Object.StoreFeatureModule_Factory [as factory] (http://localhost:4200/vendor.js:64143:380)
at R3Injector.hydrate (http://localhost:4200/vendor.js:22555:63)
at R3Injector.get (http://localhost:4200/vendor.js:22305:33)
at http://localhost:4200/vendor.js:22351:25
根據這篇文章的提示:
https://www.manongdao.com/article-974354.html
StoreModule.forRoot should only be called once in the root of your project NgModule. If you wan’t to register a feature, use StoreModule.forFeature. Using forRoot registers the global providers needed for Store.
在app module里添加一行代碼即可解決:
StoreModule.forRoot({})總結
以上是生活随笔為你收集整理的如何处理使用ngrx时遇到的错误消息: NullInjectorError R3InjectorError(AppModule)[StoreFeatureModule]的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 91% 企业认为 Deepfake 类型
- 下一篇: 如何处理Angular应用的错误消息: