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