diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 71a4897..fbd5e7c 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -1,16 +1,10 @@ import {NgModule} from '@angular/core'; -import {Title, BrowserModule} from "@angular/platform-browser"; -import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BrowserModule} from "@angular/platform-browser"; import {HttpModule} from '@angular/http'; import {AppComponent} from './app.component'; import {LoginService} from "./services/login-service/login-service"; -import {UserStore} from "./services/stores/user.store"; -import {ShowErrorComponent} from './common/show-error/show-error.component'; -import {APPLICATION_VALIDATORS} from './models/app-validators'; import {appRouting, routingComponents, routingProviders} from './app.routing'; import {AUTH_ENABLED} from './app.tokens'; -import {UserService} from "./services/user-service/user.service"; -import {UserItemComponent} from "./users/user-list/user-item.component"; import {SquadService} from "./services/squad-service/squad.service"; import {SquadStore} from "./services/stores/squad.store"; import {DecorationStore} from "./services/stores/decoration.store"; @@ -26,21 +20,17 @@ import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from "./login/login.guard" import {AwardingService} from "./services/awarding-service/awarding.service"; import {HttpClient} from "./services/http-client"; import {ArmyService} from "./services/army-service/army.service"; -import { ClipboardModule } from 'ngx-clipboard'; +import {ClipboardModule} from 'ngx-clipboard'; import {AppUserService} from "./services/app-user-service/app-user.service"; import {AppUserStore} from "./services/stores/app-user.store"; import {PromotionService} from "./services/promotion-service/promotion.service"; import {FilterRankPipe} from "./filter/filter.pipe"; import {WarService} from "./services/war-service/war.service"; -import {DataTableModule} from "angular2-datatable"; -import {NgxChartsModule} from "@swimlane/ngx-charts"; -import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; -import {AccordionModule} from "ngx-bootstrap"; import {SharedModule} from "./shared.module"; +import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; @NgModule({ - imports: [SharedModule, BrowserModule, appRouting, HttpModule, ClipboardModule, DataTableModule, - BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot()], + imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule], providers: [ HttpClient, LoginService, @@ -50,7 +40,6 @@ import {SharedModule} from "./shared.module"; ArmyService, AppUserService, AppUserStore, - UserService, SquadService, SquadStore, DecorationService, @@ -59,9 +48,7 @@ import {SharedModule} from "./shared.module"; RankStore, AwardingService, PromotionService, - WarService, AppConfig, - Title, routingProviders, {provide: AUTH_ENABLED, useValue: true} ], @@ -72,8 +59,7 @@ import {SharedModule} from "./shared.module"; DecorationItemComponent, RankItemComponent, FilterRankPipe, - SquadItemComponent, - APPLICATION_VALIDATORS], + SquadItemComponent], bootstrap: [AppComponent] }) export class AppModule { diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index b8e3621..6ae6371 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -13,14 +13,14 @@ import {RequestPromotionComponent} from "./request/promotion/req-promotion.compo import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-promotion.component"; import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component"; import {RouteConfig} from "./app.config"; -import {statsRoutes, statsRoutingComponents} from "./statistic/stats.routing"; +import {statsRoutingComponents} from "./statistic/stats.routing"; export const appRoutes: Routes = [ {path: RouteConfig.overviewPath, children: armyRoutes}, {path: '', redirectTo: RouteConfig.overviewPath, pathMatch: 'full'}, - {path: RouteConfig.statsPath, children: statsRoutes}, + {path: RouteConfig.statsPath, loadChildren: './statistic/stats.module#StatsModule'}, {path: RouteConfig.loginPath, component: LoginComponent}, {path: RouteConfig.signUpPath, component: SignupComponent}, @@ -46,6 +46,6 @@ export const appRouting = RouterModule.forRoot(appRoutes); export const routingComponents = [LoginComponent, SignupComponent, RequestAwardComponent, RequestPromotionComponent, ConfirmAwardComponent, ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent, - ...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents, ...statsRoutingComponents]; + ...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; diff --git a/static/src/app/statistic/stats.module.ts b/static/src/app/statistic/stats.module.ts new file mode 100644 index 0000000..18a8e47 --- /dev/null +++ b/static/src/app/statistic/stats.module.ts @@ -0,0 +1,17 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from "@angular/common"; +import {SharedModule} from "../shared.module"; +import {statsRouterModule, statsRoutingComponents} from "./stats.routing"; +import {WarService} from "../services/war-service/war.service"; +import {DataTableModule} from "angular2-datatable"; +import {NgxChartsModule} from "@swimlane/ngx-charts"; +import {AccordionModule} from "ngx-bootstrap"; + +@NgModule({ + declarations: statsRoutingComponents, + imports: [CommonModule, SharedModule, statsRouterModule, NgxChartsModule, AccordionModule.forRoot(), DataTableModule], + providers: [WarService] +}) +export class StatsModule { + static routes = statsRouterModule; +} diff --git a/static/src/app/statistic/stats.routing.ts b/static/src/app/statistic/stats.routing.ts index b34c8d1..ffc10cd 100644 --- a/static/src/app/statistic/stats.routing.ts +++ b/static/src/app/statistic/stats.routing.ts @@ -1,10 +1,11 @@ -import {Routes} from "@angular/router"; +import {RouterModule, Routes} from "@angular/router"; import {StatisticComponent} from "./stats.component"; import {WarDetailComponent} from "./war-detail/war-detail.component"; import {WarSubmitComponent} from "./war-submit/war-submit.component"; import {WarListComponent} from "./war-list/war-list.component"; import {StatisticOverviewComponent} from "./overview/stats-overview.component"; import {WarItemComponent} from "./war-list/war-item.component"; +import {ModuleWithProviders} from "@angular/core"; export const statsRoutes: Routes = [{ @@ -32,6 +33,8 @@ export const statsRoutes: Routes = [{ outlet: 'right' }]; +export const statsRouterModule: ModuleWithProviders = RouterModule.forChild(statsRoutes); + export const statsRoutingComponents = [StatisticComponent, StatisticOverviewComponent, WarListComponent, WarSubmitComponent, WarDetailComponent, WarItemComponent];