import 'rxjs/add/operator/first' ; import { NgModule } from '@angular/core' ; import { CommonModule } from '@angular/common' ; import { RouterModule } from '@angular/router' ; import { MaterialModule } from '@angular/material' ; import { Store } from '@ngrx/store' ; import { State , Actions } from 'ngrx-domains' ; import { StatsPageComponent } from './components/stats-page/stats-page.component' ; import { routes } from './routes' ; import './domain/stats' ; @ NgModule ( { imports : [ CommonModule , MaterialModule , RouterModule . forChild ( routes ) ] , declarations : [ StatsPageComponent ] } ) export class LazyStatsModule { constructor ( store ) { store . first ( ) . filter ( state => ! state . stats ) . subscribe ( state => store . dispatch ( new Actions . stats . ResetStatsAction ( ) ) ) ; } }