This commit is contained in:
insanity 2018-05-16 17:25:04 +09:00
parent c331f7cfaa
commit 56768d5f81
6 changed files with 65 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import { AuthGuard } from './commons/guard/auth.guard';
const routes: Routes = [
{ path: '', loadChildren: './pages/pages.module#PagesModule', canActivate: [AuthGuard] },
{ path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' },
// { path: '**', component: NotFoundPageComponent },
{ path: '**', loadChildren: './pages/error/error-page.module#ErrorPageModule' },
// { path: 'errors', loadChildren: './pages/errors/errors-page.module#ErrorsPageModule' },
];

View File

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ErrorPageComponent } from './error-page.component';
const routes: Routes = [
{
path: '',
component: ErrorPageComponent,
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ErrorPageRoutingModule { }

View File

@ -0,0 +1 @@
Error Page

View File

@ -0,0 +1,18 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'of-pages-error',
templateUrl: './error-page.component.html',
})
export class ErrorPageComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ErrorPageComponent } from './error-page.component';
import { ErrorPageRoutingModule } from './error-page-routing.module';
import { PrimeNGModules } from 'packages/commons/prime-ng/prime-ng.module';
@NgModule({
imports: [
CommonModule,
ErrorPageRoutingModule,
PrimeNGModules,
],
entryComponents: [
],
declarations: [ErrorPageComponent]
})
export class ErrorPageModule { }

View File

@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
@ -6,19 +6,26 @@ import { Subscription } from 'rxjs/Subscription';
selector: 'of-pages-probe',
templateUrl: './probe-page.component.html',
})
export class ProbePageComponent {
export class ProbePageComponent implements OnInit, OnDestroy {
private tabs = undefined;
private routerSubscription: Subscription;
private routerSubscription$: Subscription;
constructor(private router: Router) {
router.events.subscribe((event) => {
}
ngOnInit() {
this.routerSubscription$ = this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
this.generateTabMenu(event);
}
});
}
ngOnDestroy() {
this.routerSubscription$.unsubscribe();
}
generateTabMenu(event: NavigationEnd) {
const parsedUrl = event.url.split('probe/')[1].split('/')[0];
switch (parsedUrl) {