From 1c0b53558864de0242b7570f80c56c86b2745f0a Mon Sep 17 00:00:00 2001 From: Alain Chautard Date: Tue, 5 Jun 2018 10:42:36 -0600 Subject: [PATCH] Added router store --- src/app/app.module.ts | 4 +++- src/app/reducers/index.ts | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index c969408e..f8416eda 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -17,6 +17,7 @@ import { StoreDevtoolsModule } from '@ngrx/store-devtools'; import { environment } from '../environments/environment'; import { EffectsModule } from '@ngrx/effects'; import { CurrentConditionsEffects } from './effects/current-conditions.effects'; +import { routerReducer, StoreRouterConnectingModule } from '@ngrx/router-store'; @NgModule({ declarations: [ @@ -34,7 +35,8 @@ import { CurrentConditionsEffects } from './effects/current-conditions.effects'; routing, StoreModule.forRoot(reducers, { metaReducers }), !environment.production ? StoreDevtoolsModule.instrument() : [], - EffectsModule.forRoot([CurrentConditionsEffects]) + EffectsModule.forRoot([CurrentConditionsEffects]), + StoreRouterConnectingModule.forRoot({stateKey: 'router'}) ], providers: [WeatherService], bootstrap: [AppComponent] diff --git a/src/app/reducers/index.ts b/src/app/reducers/index.ts index 0e21a2b6..eab97435 100644 --- a/src/app/reducers/index.ts +++ b/src/app/reducers/index.ts @@ -9,15 +9,18 @@ import { environment } from '../../environments/environment'; import {reducer as zipCodeReducer} from './zip-codes.reducer'; import {State as ZipCodeState} from './zip-codes.reducer'; import {currentConditionsReducer, CurrentConditionsState} from './current-conditions.reducer'; +import {routerReducer, RouterReducerState} from '@ngrx/router-store'; export interface State { zipcodes: ZipCodeState, - currentConditions: CurrentConditionsState + currentConditions: CurrentConditionsState, + router: RouterReducerState } export const reducers: ActionReducerMap = { zipcodes: zipCodeReducer, - currentConditions: currentConditionsReducer + currentConditions: currentConditionsReducer, + router: routerReducer };