This repository was archived by the owner on Dec 18, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 3
3
DocumentationItems ,
4
4
DocCategory
5
5
} from '../../shared/documentation-items/documentation-items' ;
6
- import { ActivatedRoute , RouterModule } from '@angular/router' ;
6
+ import { ActivatedRoute , Router , RouterModule } from '@angular/router' ;
7
7
import { ComponentPageTitle } from '../page-title/page-title' ;
8
8
import { SvgViewerModule } from '../../shared/svg-viewer/svg-viewer' ;
9
9
import { CommonModule } from '@angular/common' ;
@@ -19,10 +19,16 @@ export class ComponentList {
19
19
20
20
constructor ( public docItems : DocumentationItems ,
21
21
private _componentPageTitle : ComponentPageTitle ,
22
- private _route : ActivatedRoute ) {
22
+ private _route : ActivatedRoute ,
23
+ private router : Router ) {
23
24
_route . params . subscribe ( p => {
24
25
this . category = docItems . getCategoryById ( p [ 'id' ] ) ;
25
- this . _componentPageTitle . title = this . category . name ;
26
+
27
+ if ( this . category ) {
28
+ this . _componentPageTitle . title = this . category . name ;
29
+ } else {
30
+ this . router . navigate ( [ '/categories' ] ) ;
31
+ }
26
32
} ) ;
27
33
}
28
34
}
Original file line number Diff line number Diff line change 1
1
import { Component , NgModule } from '@angular/core' ;
2
- import { ActivatedRoute , RouterModule } from '@angular/router' ;
2
+ import { ActivatedRoute , Router , RouterModule } from '@angular/router' ;
3
3
import { GuideItem , GuideItems } from '../../shared/guide-items/guide-items' ;
4
4
import { FooterModule } from '../../shared/footer/footer' ;
5
5
import { DocViewerModule } from '../../shared/doc-viewer/doc-viewer-module' ;
@@ -13,9 +13,15 @@ import {DocViewerModule} from '../../shared/doc-viewer/doc-viewer-module';
13
13
export class GuideViewer {
14
14
guide : GuideItem ;
15
15
16
- constructor ( private _route : ActivatedRoute , public guideItems : GuideItems ) {
16
+ constructor ( private _route : ActivatedRoute ,
17
+ private router : Router ,
18
+ public guideItems : GuideItems ) {
17
19
_route . params . subscribe ( p => {
18
20
this . guide = guideItems . getItemById ( p [ 'id' ] ) ;
21
+
22
+ if ( ! this . guide ) {
23
+ this . router . navigate ( [ '/guides' ] ) ;
24
+ }
19
25
} ) ;
20
26
}
21
27
}
You can’t perform that action at this time.
0 commit comments