1 import { ApplicationRef, NgModule } from '@angular/core';
2 import { BrowserModule } from '@angular/platform-browser';
3 import { removeNgStyles, createNewHosts } from '@angularclass/hmr';
5 import { MetaModule, MetaConfig } from 'ng2-meta';
7 import { ENV_PROVIDERS } from './environment';
8 import { AppRoutingModule } from './app-routing.module';
9 import { AppComponent } from './app.component';
10 import { AppState } from './app.service';
12 import { AccountModule } from './account';
13 import { AdminModule } from './admin';
14 import { CoreModule } from './core';
15 import { LoginModule } from './login';
16 import { SharedModule } from './shared';
17 import { VideosModule } from './videos';
19 const metaConfig: MetaConfig = {
20 //Append a title suffix such as a site name to all titles
28 // Application wide providers
29 const APP_PROVIDERS = [
34 bootstrap: [ AppComponent ],
46 MetaModule.forRoot(metaConfig),
55 providers: [ // expose our Services and Providers into Angular's dependency injection
60 export class AppModule {
61 constructor(public appRef: ApplicationRef, public appState: AppState) {}
63 if (!store || !store.state) return;
64 console.log('HMR store', store);
65 this.appState._state = store.state;
70 const cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
72 const state = this.appState._state;
74 store.disposeOldHosts = createNewHosts(cmpLocation);
78 hmrAfterDestroy(store) {
79 // display new elements
80 store.disposeOldHosts();
81 delete store.disposeOldHosts;