overflow-webapp/src/app/app.module.ts

70 lines
2.2 KiB
TypeScript
Raw Normal View History

2018-01-29 13:22:32 +09:00
import { NgModule } from '@angular/core';
2018-01-25 17:03:29 +09:00
import { BrowserModule } from '@angular/platform-browser';
2018-01-25 17:03:36 +09:00
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
2018-01-29 13:22:32 +09:00
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import {
StoreRouterConnectingModule,
RouterStateSerializer,
} from '@ngrx/router-store';
import { EffectsModule } from '@ngrx/effects';
import { environment } from '../environments/environment';
2018-01-25 17:03:29 +09:00
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
2018-01-25 17:03:36 +09:00
import { MaterialModule } from './commons/ui/material/material.module';
2018-01-29 13:22:32 +09:00
import { SimpleRouterStateSerializer } from './commons/router/state/serializer/simple-router-state-serializer';
import { reducers } from './app.reducers';
2018-01-25 17:03:29 +09:00
@NgModule({
declarations: [
2018-01-25 17:03:36 +09:00
AppComponent,
2018-01-25 17:03:29 +09:00
],
imports: [
BrowserModule,
2018-01-25 17:03:36 +09:00
BrowserAnimationsModule,
AppRoutingModule,
2018-01-29 13:22:32 +09:00
StoreModule.forRoot(reducers),
/**
* @ngrx/router-store keeps router state up-to-date in the store.
*/
StoreRouterConnectingModule.forRoot({
/*
They stateKey defines the name of the state used by the router-store reducer.
This matches the key defined in the map of reducers
*/
stateKey: 'router',
}),
/**
* Store devtools instrument the store retaining past versions of state
* and recalculating new states. This enables powerful time-travel
* debugging.
*
* To use the debugger, install the Redux Devtools extension for either
* Chrome or Firefox
*
* See: https://github.com/zalmoxisus/redux-devtools-extension
*/
StoreDevtoolsModule.instrument({
name: 'overFlow WebApp DevTools',
logOnly: environment.production,
}),
EffectsModule.forRoot([]),
2018-01-25 17:03:36 +09:00
MaterialModule,
2018-01-25 17:03:29 +09:00
],
2018-01-29 13:22:32 +09:00
providers: [
/**
* The `RouterStateSnapshot` provided by the `Router` is a large complex structure.
* A custom RouterStateSerializer is used to parse the `RouterStateSnapshot` provided
* by `@ngrx/router-store` to include only the desired pieces of the snapshot.
*/
{ provide: RouterStateSerializer, useClass: SimpleRouterStateSerializer },
],
2018-01-25 17:03:29 +09:00
bootstrap: [AppComponent]
})
export class AppModule { }