@@ -21,7 +21,7 @@ import {
21
21
RouterLinkActive ,
22
22
RouterLink ,
23
23
} from '@angular/router' ;
24
- import { combineLatest , Observable , Subscription } from 'rxjs' ;
24
+ import { Observable , of , Subscription } from 'rxjs' ;
25
25
import { map , switchMap } from 'rxjs/operators' ;
26
26
27
27
import { DocumentationItems } from '../../shared/documentation-items/documentation-items' ;
@@ -66,11 +66,9 @@ const SMALL_WIDTH_BREAKPOINT = 959;
66
66
} )
67
67
export class ComponentSidenav implements OnInit , OnDestroy {
68
68
docItems = inject ( DocumentationItems ) ;
69
- private _route = inject ( ActivatedRoute ) ;
70
69
private _navigationFocusService = inject ( NavigationFocusService ) ;
71
70
72
71
readonly sidenav = viewChild ( MatSidenav ) ;
73
- params : Observable < Params > ;
74
72
isExtraScreenSmall : Observable < boolean > ;
75
73
isScreenSmall : Observable < boolean > ;
76
74
private _subscriptions = new Subscription ( ) ;
@@ -84,11 +82,6 @@ export class ComponentSidenav implements OnInit, OnDestroy {
84
82
this . isScreenSmall = breakpoints
85
83
. observe ( `(max-width: ${ SMALL_WIDTH_BREAKPOINT } px)` )
86
84
. pipe ( map ( breakpoint => breakpoint . matches ) ) ;
87
-
88
- this . params = combineLatest (
89
- this . _route . pathFromRoot . map ( route => route . params ) ,
90
- Object . assign ,
91
- ) ;
92
85
}
93
86
94
87
ngOnInit ( ) {
@@ -120,12 +113,11 @@ export class ComponentSidenav implements OnInit, OnDestroy {
120
113
} )
121
114
export class ComponentNav {
122
115
private _docItems = inject ( DocumentationItems ) ;
123
- readonly params = input < Params | null > ( ) ;
116
+ private _route = inject ( ActivatedRoute ) ;
117
+ protected _params = this . _route . params ;
124
118
125
- items = toObservable ( this . params ) . pipe (
126
- switchMap ( params =>
127
- params ?. section ? this . _docItems . getItems ( params . section ) : Promise . resolve ( null ) ,
128
- ) ,
119
+ items = this . _params . pipe (
120
+ switchMap ( params => ( params ?. section ? this . _docItems . getItems ( params . section ) : of ( [ ] ) ) ) ,
129
121
) ;
130
122
}
131
123
0 commit comments