2017-05-27 03:51:48 +00:00
|
|
|
import { NgModule, ApplicationRef } from "@angular/core";
|
|
|
|
import { BrowserModule } from "@angular/platform-browser";
|
|
|
|
import { HttpModule } from "@angular/http";
|
|
|
|
import { FormsModule } from "@angular/forms";
|
|
|
|
import { AppComponent } from "./app.component";
|
|
|
|
import { HomeComponent } from "./home/home.component";
|
|
|
|
import { routing } from "./app.routing";
|
|
|
|
import { removeNgStyles, createNewHosts } from "@angularclass/hmr";
|
|
|
|
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
|
2017-05-27 07:27:36 +00:00
|
|
|
import { RiotComponent } from "./riot/riot.component";
|
|
|
|
import { ApiService } from "./shared/api.service";
|
|
|
|
import { UiSwitchModule } from "angular2-ui-switch";
|
2017-05-27 23:45:07 +00:00
|
|
|
import { ScalarService } from "./shared/scalar.service";
|
|
|
|
import { ToasterModule } from "angular2-toaster";
|
|
|
|
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
|
2017-05-28 06:35:40 +00:00
|
|
|
import { IntegrationComponent } from "./integration/integration.component";
|
2017-05-28 06:53:12 +00:00
|
|
|
import { ScalarCloseComponent } from "./riot/scalar-close/scalar-close.component";
|
2017-05-29 04:51:04 +00:00
|
|
|
import { IntegrationService } from "./shared/integration.service";
|
2017-08-27 05:26:00 +00:00
|
|
|
import { BootstrapModalModule } from "ngx-modialog/plugins/bootstrap";
|
|
|
|
import { ModalModule } from "ngx-modialog";
|
2017-05-29 04:51:04 +00:00
|
|
|
import { RssConfigComponent } from "./configs/rss/rss-config.component";
|
2017-06-05 03:31:31 +00:00
|
|
|
import { IrcConfigComponent } from "./configs/irc/irc-config.component";
|
2017-06-11 00:58:05 +00:00
|
|
|
import { IrcApiService } from "./shared/irc-api.service";
|
2017-05-27 03:51:48 +00:00
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
imports: [
|
|
|
|
BrowserModule,
|
|
|
|
HttpModule,
|
|
|
|
FormsModule,
|
|
|
|
routing,
|
2017-05-27 07:27:36 +00:00
|
|
|
NgbModule.forRoot(),
|
|
|
|
UiSwitchModule,
|
2017-05-27 23:45:07 +00:00
|
|
|
ToasterModule,
|
|
|
|
BrowserAnimationsModule,
|
2017-05-29 04:51:04 +00:00
|
|
|
ModalModule.forRoot(),
|
|
|
|
BootstrapModalModule,
|
2017-05-27 03:51:48 +00:00
|
|
|
],
|
|
|
|
declarations: [
|
|
|
|
AppComponent,
|
2017-05-27 07:27:36 +00:00
|
|
|
HomeComponent,
|
|
|
|
RiotComponent,
|
2017-05-28 06:35:40 +00:00
|
|
|
IntegrationComponent,
|
2017-05-28 06:53:12 +00:00
|
|
|
ScalarCloseComponent,
|
2017-05-29 04:51:04 +00:00
|
|
|
RssConfigComponent,
|
2017-06-05 03:31:31 +00:00
|
|
|
IrcConfigComponent,
|
2017-05-27 07:27:36 +00:00
|
|
|
|
|
|
|
// Vendor
|
2017-05-27 03:51:48 +00:00
|
|
|
],
|
|
|
|
providers: [
|
2017-05-27 07:27:36 +00:00
|
|
|
ApiService,
|
2017-05-27 23:45:07 +00:00
|
|
|
ScalarService,
|
2017-05-29 04:51:04 +00:00
|
|
|
IntegrationService,
|
2017-06-11 00:58:05 +00:00
|
|
|
IrcApiService,
|
2017-05-27 07:27:36 +00:00
|
|
|
|
|
|
|
// Vendor
|
2017-05-27 03:51:48 +00:00
|
|
|
],
|
|
|
|
bootstrap: [AppComponent],
|
2017-05-29 04:51:04 +00:00
|
|
|
entryComponents: [
|
|
|
|
RssConfigComponent,
|
2017-06-05 03:31:31 +00:00
|
|
|
IrcConfigComponent,
|
2017-05-29 04:51:04 +00:00
|
|
|
]
|
2017-05-27 03:51:48 +00:00
|
|
|
})
|
|
|
|
export class AppModule {
|
|
|
|
constructor(public appRef: ApplicationRef) {
|
|
|
|
}
|
|
|
|
|
|
|
|
hmrOnInit(store) {
|
2017-08-27 05:26:00 +00:00
|
|
|
console.log("HMR store", store);
|
2017-05-27 03:51:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|