aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/app.module.ts
blob: a87ffb5b7423c690c26737d105247694a650b4db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { ApplicationRef, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { ApiService } from './shared';
import { routing } from './app.routing';
import { createNewHosts, removeNgStyles } from '@angularclass/hmr';
import { BrowseSdcModule } from './browseSdc/browseSdc.module';
import { VlanTaggingModule } from './vlanTagging/vlan-tagging.module'
import { BootstrapModalModule } from 'ng2-bootstrap-modal';
import { HashLocationStrategy, LocationStrategy } from "@angular/common";
import { InstantiationStatusModule } from './instantiationStatus/InstantiationStatus.module';
import { SharedModule } from './shared/shared.module';
import { AngularSvgIconModule } from 'angular-svg-icon';
import { NgReduxModule } from '@angular-redux/store';
import { StoreModule } from "./store/module";
import { HttpInterceptorService } from './shared/utils/httpInterceptor/httpInterceptor.service';
import { DrawingBoardModule } from './drawingBoard/drawingBoard.module';
import { HealthStatusComponent } from './healthStatus/health-status.component';
import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to';
import { LogService } from './shared/utils/log/log.service';

@NgModule({
  imports: [
    BrowserModule,
    HttpClientModule,
    FormsModule,
    routing,
    SharedModule.forRoot(),
    ScrollToModule.forRoot(),
    DrawingBoardModule,
    VlanTaggingModule,
    InstantiationStatusModule,
    BrowseSdcModule,
    BootstrapModalModule,
    BrowseSdcModule,
    AngularSvgIconModule,
    ReactiveFormsModule,
    NgReduxModule,
    StoreModule,
  ],
  declarations: [
    AppComponent,
    HomeComponent,
    HealthStatusComponent
  ],
  providers: [
    ApiService,
    LogService,
    { provide: LocationStrategy, useClass: HashLocationStrategy },
    { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptorService, multi: true }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
  private static CustomLoader: any;

  constructor(public appRef: ApplicationRef) {
    //for ng2-bootstrap-modal in angualar 5
    Object.defineProperty(appRef, '_rootComponents', { get: () => appRef['components'] });
  }
  hmrOnInit(store) {
    console.log('HMR store', store);
  }
  hmrOnDestroy(store) {
    let cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
    // recreate elements
    store.disposeOldHosts = createNewHosts(cmpLocation);
    // remove styles
    removeNgStyles();
  }
  hmrAfterDestroy(store) {
    // display new elements
    store.disposeOldHosts();
    delete store.disposeOldHosts;
  }
}