add shared module

pull/7/head
Florian Hartwich 2017-09-02 22:59:13 +02:00
parent 164f4543c7
commit 386a53af96
5 changed files with 25 additions and 27 deletions

View File

@ -36,9 +36,10 @@ import {DataTableModule} from "angular2-datatable";
import {NgxChartsModule} from "@swimlane/ngx-charts"; import {NgxChartsModule} from "@swimlane/ngx-charts";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {AccordionModule} from "ngx-bootstrap"; import {AccordionModule} from "ngx-bootstrap";
import {SharedModule} from "./shared.module";
@NgModule({ @NgModule({
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule, DataTableModule, imports: [SharedModule, BrowserModule, appRouting, HttpModule, ClipboardModule, DataTableModule,
BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot()], BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot()],
providers: [ providers: [
HttpClient, HttpClient,
@ -72,7 +73,6 @@ import {AccordionModule} from "ngx-bootstrap";
RankItemComponent, RankItemComponent,
FilterRankPipe, FilterRankPipe,
SquadItemComponent, SquadItemComponent,
ShowErrorComponent,
APPLICATION_VALIDATORS], APPLICATION_VALIDATORS],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })

View File

@ -2,7 +2,6 @@ import {RouterModule, Routes} from "@angular/router";
import {LoginComponent} from "./login/index"; import {LoginComponent} from "./login/index";
import {NotFoundComponent} from "./common/not-found/not-found.component"; import {NotFoundComponent} from "./common/not-found/not-found.component";
import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard";
import {usersRoutes, usersRoutingComponents} from "./users/users.routing";
import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing"; import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing";
import {decorationsRoutes, decorationsRoutingComponents} from "./decorations/decoration.routing"; import {decorationsRoutes, decorationsRoutingComponents} from "./decorations/decoration.routing";
import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing"; import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing";
@ -15,7 +14,6 @@ import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-pro
import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component"; import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component";
import {RouteConfig} from "./app.config"; import {RouteConfig} from "./app.config";
import {statsRoutes, statsRoutingComponents} from "./statistic/stats.routing"; import {statsRoutes, statsRoutingComponents} from "./statistic/stats.routing";
import UsersModule from "./users/users.module";
export const appRoutes: Routes = [ export const appRoutes: Routes = [
@ -32,7 +30,7 @@ export const appRoutes: Routes = [
{path: RouteConfig.confirmAwardPath, component: ConfirmAwardComponent, canActivate: [LoginGuardHL]}, {path: RouteConfig.confirmAwardPath, component: ConfirmAwardComponent, canActivate: [LoginGuardHL]},
{path: RouteConfig.confirmPromotionPath, component: ConfirmPromotionComponent, canActivate: [LoginGuardHL]}, {path: RouteConfig.confirmPromotionPath, component: ConfirmPromotionComponent, canActivate: [LoginGuardHL]},
{path: RouteConfig.userPath, loadChildren: './users/users.module', canActivate: [LoginGuardHL]}, {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]},
{path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]},
{path: RouteConfig.decorationPath, children: decorationsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.decorationPath, children: decorationsRoutes, canActivate: [LoginGuardHL]},
{path: RouteConfig.rankPath, children: ranksRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.rankPath, children: ranksRoutes, canActivate: [LoginGuardHL]},

View File

@ -0,0 +1,12 @@
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {ShowErrorComponent} from "./common/show-error/show-error.component";
import {CommonModule} from "@angular/common";
@NgModule({
declarations: [ShowErrorComponent],
imports: [CommonModule, FormsModule, ReactiveFormsModule],
exports: [FormsModule, ReactiveFormsModule, ShowErrorComponent]
})
export class SharedModule {
}

View File

@ -2,27 +2,14 @@ import { NgModule } from '@angular/core';
import {routes, usersRoutingComponents} from './users.routing'; import {routes, usersRoutingComponents} from './users.routing';
import {UserStore} from "../services/stores/user.store"; import {UserStore} from "../services/stores/user.store";
import {UserService} from "../services/user-service/user.service"; import {UserService} from "../services/user-service/user.service";
import {BrowserModule} from "@angular/platform-browser"; import {CommonModule} from "@angular/common";
import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {SharedModule} from "../shared.module";
import {HttpModule} from "@angular/http";
import {AccordionModule} from "ngx-bootstrap";
import {NgxChartsModule} from "@swimlane/ngx-charts";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {DataTableModule} from "angular2-datatable";
import {ClipboardModule} from "ngx-clipboard/dist";
import {UsersComponent} from "./users.component";
import {UserItemComponent} from "./user-list/user-item.component";
import {UserListComponent} from "./user-list/user-list.component";
import {EditUserComponent} from "./edit-user/edit-user.component";
import {AwardUserComponent} from "./award-user/award-user.component";
import {ShowErrorComponent} from "../common/show-error/show-error.component";
@NgModule({ @NgModule({
declarations: [ UsersComponent, UserListComponent, UserItemComponent, EditUserComponent, AwardUserComponent, ShowErrorComponent ], declarations: usersRoutingComponents,
imports: [ BrowserModule, FormsModule, ReactiveFormsModule, HttpModule, ClipboardModule, DataTableModule, imports: [CommonModule, SharedModule, routes],
BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot(), routes ],
providers: [UserStore, UserService] providers: [UserStore, UserService]
}) })
export default class UsersModule { export class UsersModule {
static routes = routes; static routes = routes;
}; }

View File

@ -4,6 +4,7 @@ import {EditUserComponent} from "./edit-user/edit-user.component";
import {UserListComponent} from "./user-list/user-list.component"; import {UserListComponent} from "./user-list/user-list.component";
import {AwardUserComponent} from "./award-user/award-user.component"; import {AwardUserComponent} from "./award-user/award-user.component";
import {ModuleWithProviders} from "@angular/core"; import {ModuleWithProviders} from "@angular/core";
import {UserItemComponent} from "./user-list/user-item.component";
export const usersRoutes: Routes = [{ export const usersRoutes: Routes = [{
path: '', component: UsersComponent, path: '', component: UsersComponent,
@ -33,4 +34,4 @@ export const usersRoutes: Routes = [{
export const routes: ModuleWithProviders = RouterModule.forChild(usersRoutes); export const routes: ModuleWithProviders = RouterModule.forChild(usersRoutes);
export const usersRoutingComponents = [UsersComponent, UserListComponent, EditUserComponent, AwardUserComponent]; export const usersRoutingComponents = [UserItemComponent, UsersComponent, UserListComponent, EditUserComponent, AwardUserComponent];