Release v1.4.0 : Introduce lazy loading #7

Merged
hardi merged 1 commits from task/lazy-loading into master 2017-09-03 13:11:49 +02:00
4 changed files with 58 additions and 22 deletions

View File

@ -19,6 +19,8 @@ import {ClipboardModule} from 'ngx-clipboard';
import {PromotionService} from "./services/promotion-service/promotion.service"; import {PromotionService} from "./services/promotion-service/promotion.service";
import {SharedModule} from "./shared.module"; import {SharedModule} from "./shared.module";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {UserService} from "./services/user-service/user.service";
import {UserStore} from "./services/stores/user.store";
@NgModule({ @NgModule({
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule], imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule],
@ -28,6 +30,8 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
LoginGuardSQL, LoginGuardSQL,
LoginGuardHL, LoginGuardHL,
LoginGuardAdmin, LoginGuardAdmin,
UserService,
UserStore,
ArmyService, ArmyService,
SquadService, SquadService,
SquadStore, SquadStore,

View File

@ -7,31 +7,65 @@ import {SignupComponent} from "./login/signup.component";
import {RouteConfig} from "./app.config"; import {RouteConfig} from "./app.config";
export const appRoutes: Routes = [ export const appRoutes: Routes = [
{
{path: RouteConfig.overviewPath, children: armyRoutes}, path: RouteConfig.overviewPath,
{path: '', redirectTo: RouteConfig.overviewPath, pathMatch: 'full'}, children: armyRoutes
},
{path: RouteConfig.statsPath, loadChildren: './statistic/stats.module#StatsModule'}, {
path: '', redirectTo: RouteConfig.overviewPath,
{path: RouteConfig.loginPath, component: LoginComponent}, pathMatch: 'full'
{path: RouteConfig.signUpPath, component: SignupComponent}, },
{
{path: RouteConfig.request, loadChildren: './request/request.module#RequestModule'}, path: RouteConfig.statsPath,
loadChildren: './statistic/stats.module#StatsModule'
{path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, },
{path: RouteConfig.squadPath, loadChildren: './squads/squads.module#SquadsModule', canActivate: [LoginGuardHL]}, {
path: RouteConfig.loginPath,
component: LoginComponent
},
{
path: RouteConfig.signUpPath,
component: SignupComponent
},
{
path: RouteConfig.request,
loadChildren: './request/request.module#RequestModule'
},
{
path: RouteConfig.userPath,
loadChildren: './users/users.module#UsersModule',
canActivate: [LoginGuardHL]
},
{
path: RouteConfig.squadPath,
loadChildren: './squads/squads.module#SquadsModule',
canActivate: [LoginGuardHL]
},
{ {
path: RouteConfig.decorationPath, path: RouteConfig.decorationPath,
loadChildren: './decorations/decoration.module#DecorationsModule', loadChildren: './decorations/decoration.module#DecorationsModule',
canActivate: [LoginGuardHL] canActivate: [LoginGuardHL]
}, },
{path: RouteConfig.rankPath, loadChildren: './ranks/ranks.module#RanksModule', canActivate: [LoginGuardHL]}, {
path: RouteConfig.rankPath,
loadChildren: './ranks/ranks.module#RanksModule',
canActivate: [LoginGuardHL]
},
{
path: RouteConfig.adminPanelPath,
loadChildren: './admin/admin.module#AdminModule',
canActivate: [LoginGuardAdmin]
},
{path: RouteConfig.adminPanelPath, loadChildren: './admin/admin.module#AdminModule', canActivate: [LoginGuardAdmin]}, /** Redirect Configuration **/
{
/** Redirect Konfigurationen **/ path: '404',
{path: '404', component: NotFoundComponent}, component: NotFoundComponent
{path: '**', redirectTo: '/404'}, // immer als letztes konfigurieren - erste Route die matched wird angesteuert },
{
path: '**',
redirectTo: '/404'
} // always configure this last - first matching route gets processed
]; ];
export const appRouting = RouterModule.forRoot(appRoutes); export const appRouting = RouterModule.forRoot(appRoutes);

View File

@ -14,8 +14,7 @@ import {UserStore} from "../services/stores/user.store";
@NgModule({ @NgModule({
declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent, declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent,
ConfirmAwardComponent, FilterRankPipe], ConfirmAwardComponent, FilterRankPipe],
imports: [CommonModule, SharedModule, requestRouterModule], imports: [CommonModule, SharedModule, requestRouterModule]
providers: [UserStore, UserService]
}) })
export class RequestModule { export class RequestModule {
static routes = requestRouterModule; static routes = requestRouterModule;

View File

@ -8,7 +8,6 @@ import {SharedModule} from "../shared.module";
@NgModule({ @NgModule({
declarations: usersRoutingComponents, declarations: usersRoutingComponents,
imports: [CommonModule, SharedModule, routes], imports: [CommonModule, SharedModule, routes],
providers: [UserStore, UserService]
}) })
export class UsersModule { export class UsersModule {
static routes = routes; static routes = routes;