@@ -31,6 +31,7 @@ export class CaseViewerComponent implements OnInit, OnDestroy, AfterViewInit {
31
31
public static readonly ORIGIN_QUERY_PARAM = 'origin' ;
32
32
static readonly TRIGGER_TEXT_START = 'Go' ;
33
33
static readonly TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Go' ;
34
+ static readonly space = '%20' ;
34
35
35
36
@Input ( )
36
37
hasPrint = true ;
@@ -53,7 +54,7 @@ export class CaseViewerComponent implements OnInit, OnDestroy, AfterViewInit {
53
54
dialogConfig : MatDialogConfig ;
54
55
55
56
callbackErrorsSubject : Subject < any > = new Subject ( ) ;
56
- @ViewChild ( 'tabGroup' ) public tabGroup : any ;
57
+ @ViewChild ( 'tabGroup' ) public tabGroup : MatTabGroup ;
57
58
58
59
constructor (
59
60
private ngZone : NgZone ,
@@ -206,9 +207,11 @@ export class CaseViewerComponent implements OnInit, OnDestroy, AfterViewInit {
206
207
207
208
public ngAfterViewInit ( ) {
208
209
const url = this . location . path ( true ) ;
209
- const hashValue = url . substring ( url . indexOf ( '#' ) + 1 ) ;
210
- if ( hashValue && ! isNaN ( Number ( hashValue ) ) ) {
211
- this . tabGroup . selectedIndex = Number ( hashValue ) ;
210
+ let hashValue = url . substring ( url . indexOf ( '#' ) + 1 ) ;
211
+ hashValue = hashValue . replace ( CaseViewerComponent . space , ' ' ) ;
212
+ const matTab = this . tabGroup . _tabs . find ( ( x ) => x . textLabel === hashValue ) ;
213
+ if ( matTab && matTab . position ) {
214
+ this . tabGroup . selectedIndex = matTab . position ;
212
215
}
213
216
}
214
217
@@ -248,7 +251,7 @@ export class CaseViewerComponent implements OnInit, OnDestroy, AfterViewInit {
248
251
}
249
252
250
253
public tabChanged ( tabChangeEvent : MatTabChangeEvent ) : void {
251
- window . location . hash = tabChangeEvent . index . toString ( ) ;
254
+ window . location . hash = tabChangeEvent . tab . textLabel ;
252
255
}
253
256
254
257
}
0 commit comments