作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
更新到 Angular 5 后,我的商店模块收到一条错误消息。Angular-Redux 现在有版本 7.1.0
Unhandled Promise rejection: StaticInjectorError(AppModule)[StoreModule -> NgReduxRouter]: StaticInjectorError(Platform: core)[StoreModule -> NgReduxRouter]: NullInjectorError: No provider for NgReduxRouter! ; Zone: ; Task: Promise.then ; Value: Error: StaticInjectorError(AppModule)[StoreModule -> NgReduxRouter]:
StaticInjectorError(Platform: core)[StoreModule -> NgReduxRouter]: NullInjectorError: No provider for NgReduxRouter! at _NullInjector.get [...]
在这里你可以看到我的商店模块
import { NgModule, isDevMode } from '@angular/core';
// Angular-redux ecosystem stuff.
// @angular-redux/form and @angular-redux/router are optional
// extensions that sync form and route location state between
// our store and Angular.
import { NgReduxModule, NgRedux, DevToolsExtension } from '@angular-redux/store';
import { NgReduxRouterModule, NgReduxRouter } from '@angular-redux/router';
import { provideReduxForms } from '@angular-redux/form';
// The top-level reducers and epics that make up our app's logic.
import { IAppState, rootReducer, INITIAL_STATE } from './store';
@NgModule({
declarations: [
],
imports: [NgReduxModule, NgReduxRouterModule],
exports: [
]
//providers: [RootEpics],
})
export class StoreModule {
constructor(
public ngRedux: NgRedux<IAppState>,
devTools: DevToolsExtension,
ngReduxRouter: NgReduxRouter,
) {
// Tell Redux about our reducers and epics. If the Redux DevTools
// chrome extension is available in the browser, tell Redux about
// it too.
// devTools nur im Developmentmodus
var enhancers = isDevMode() ? [devTools.enhancer()] : [];
ngRedux.configureStore(rootReducer, INITIAL_STATE, [], enhancers);
// Enable syncing of Angular router state with our Redux store.
if (ngReduxRouter) {
ngReduxRouter.initialize();
}
// Enable syncing of Angular form state with our Redux store.
provideReduxForms(ngRedux);
}
}
谁知道该怎么做?
最佳答案
尝试将 NgReduxRouterModule
更改为 NgReduxRouterModule.forRoot()
关于angular - 更新到 angular 5 : No provider for NgReduxRouter 后出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48776455/
我是一名优秀的程序员,十分优秀!