From 711e82e6cc57fbbe19fb8f870b0b98d217261b3e Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sun, 3 Sep 2017 12:37:42 +0200 Subject: [PATCH] Add ranks module --- static/src/app/app.module.ts | 2 -- static/src/app/app.routing.ts | 6 ++---- static/src/app/ranks/ranks.module.ts | 15 +++++++++++++++ static/src/app/ranks/ranks.routing.ts | 8 ++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 static/src/app/ranks/ranks.module.ts diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 24ca5f7..23eccc1 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -9,7 +9,6 @@ import {SquadStore} from "./services/stores/squad.store"; import {DecorationStore} from "./services/stores/decoration.store"; import {DecorationService} from "./services/decoration-service/decoration.service"; import {SquadItemComponent} from "./squads/squad-list/squad-item.component"; -import {RankItemComponent} from "./ranks/rank-list/rank-item.component"; import {RankStore} from "./services/stores/rank.store"; import {RankService} from "./services/rank-service/rank.service"; import {AppConfig} from "./app.config"; @@ -45,7 +44,6 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; declarations: [ AppComponent, routingComponents, - RankItemComponent, SquadItemComponent], bootstrap: [AppComponent] }) diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index 097c775..e2c9ec1 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -3,7 +3,6 @@ import {LoginComponent} from "./login/index"; import {NotFoundComponent} from "./common/not-found/not-found.component"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard"; import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing"; -import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing"; import {armyRoutes, armyRoutingComponents} from "./army/army.routing"; import {SignupComponent} from "./login/signup.component"; import {RouteConfig} from "./app.config"; @@ -23,7 +22,7 @@ export const appRoutes: Routes = [ {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.decorationPath, loadChildren: './decorations/decoration.module#DecorationsModule', canActivate: [LoginGuardHL]}, - {path: RouteConfig.rankPath, children: ranksRoutes, canActivate: [LoginGuardHL]}, + {path: RouteConfig.rankPath, loadChildren: './ranks/ranks.module#RanksModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.adminPanelPath, loadChildren: './admin/admin.module#AdminModule', canActivate: [LoginGuardAdmin]}, @@ -34,7 +33,6 @@ export const appRoutes: Routes = [ export const appRouting = RouterModule.forRoot(appRoutes); -export const routingComponents = [LoginComponent, SignupComponent, - ...armyRoutingComponents, NotFoundComponent, ...squadsRoutingComponents, ...ranksRoutingComponents]; +export const routingComponents = [LoginComponent, SignupComponent, ...armyRoutingComponents, NotFoundComponent, ...squadsRoutingComponents]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; diff --git a/static/src/app/ranks/ranks.module.ts b/static/src/app/ranks/ranks.module.ts new file mode 100644 index 0000000..d13be6f --- /dev/null +++ b/static/src/app/ranks/ranks.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from "@angular/core"; +import {rankRouterModule, ranksRoutingComponents} from "./ranks.routing"; +import {SharedModule} from "../shared.module"; +import {CommonModule} from "@angular/common"; +import {RankService} from "../services/rank-service/rank.service"; +import {RankStore} from "../services/stores/rank.store"; + +@NgModule({ + declarations: ranksRoutingComponents, + imports: [CommonModule, SharedModule, rankRouterModule], + providers: [RankStore, RankService] +}) +export class RanksModule { + static routes = rankRouterModule; +} diff --git a/static/src/app/ranks/ranks.routing.ts b/static/src/app/ranks/ranks.routing.ts index c36f117..fc0a6c9 100644 --- a/static/src/app/ranks/ranks.routing.ts +++ b/static/src/app/ranks/ranks.routing.ts @@ -1,7 +1,9 @@ -import {Routes} from "@angular/router"; +import {RouterModule, Routes} from "@angular/router"; import {RankComponent} from "./ranks.component"; import {RankListComponent} from "./rank-list/rank-list.component"; import {EditRankComponent} from "./edit-rank/edit-rank.component"; +import {RankItemComponent} from "./rank-list/rank-item.component"; +import {ModuleWithProviders} from "@angular/core"; export const ranksRoutes: Routes = [{ @@ -24,5 +26,7 @@ export const ranksRoutes: Routes = [{ outlet: 'right' }]; -export const ranksRoutingComponents = [RankComponent, RankListComponent, EditRankComponent]; +export const rankRouterModule: ModuleWithProviders = RouterModule.forChild(ranksRoutes); + +export const ranksRoutingComponents = [RankComponent, RankItemComponent, RankListComponent, EditRankComponent];