gpt4 book ai didi

angular - 更新到 angular 5 : No provider for NgReduxRouter 后出错

转载 作者:太空狗 更新时间:2023-10-29 17:34:38 24 4
gpt4 key购买 nike

更新到 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com