更新到Angular 5之后:没有提供NgreDuxRouter的提供商



更新到Angular 5后,我的商店模块会收到一条错误消息。Angular-Redux现在具有7.1.0版本

未经治疗的承诺拒绝:staticinjectorerror(AppModule([StoreModule-> ngreduxRouter]: staticinjectorerror(平台:core([StoreModule-> ngreduxRouter]: nullinjectorError:没有ngreduxRouter的提供商!;区域:; 任务:承诺。值:错误: staticinjectorerror(appModule([StoreModule-> ngreduxRouter]:
staticinjectorerror(平台:core([StoreModule-> ngreduxRouter]: nullinjectorError:没有ngreduxRouter的提供商! 在_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()

最新更新