@@ -15,7 +15,7 @@
@if ((isScreenSmall | async) === false) {
-
+
}
diff --git a/material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts b/material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts
index dc480bb3cda3..af6a7a218bb8 100644
--- a/material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts
+++ b/material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts
@@ -5,23 +5,14 @@ import {
ViewEncapsulation,
forwardRef,
inject,
- input,
viewChild,
} from '@angular/core';
-import {toObservable} from '@angular/core/rxjs-interop';
import {BreakpointObserver} from '@angular/cdk/layout';
import {AsyncPipe} from '@angular/common';
import {MatListItem, MatNavList} from '@angular/material/list';
import {MatSidenav, MatSidenavContainer} from '@angular/material/sidenav';
-import {
- ActivatedRoute,
- Params,
- Routes,
- RouterOutlet,
- RouterLinkActive,
- RouterLink,
-} from '@angular/router';
-import {combineLatest, Observable, Subscription} from 'rxjs';
+import {ActivatedRoute, Routes, RouterOutlet, RouterLinkActive, RouterLink} from '@angular/router';
+import {Observable, of, Subscription} from 'rxjs';
import {map, switchMap} from 'rxjs/operators';
import {DocumentationItems} from '../../shared/documentation-items/documentation-items';
@@ -66,11 +57,9 @@ const SMALL_WIDTH_BREAKPOINT = 959;
})
export class ComponentSidenav implements OnInit, OnDestroy {
docItems = inject(DocumentationItems);
- private _route = inject(ActivatedRoute);
private _navigationFocusService = inject(NavigationFocusService);
readonly sidenav = viewChild(MatSidenav);
- params: Observable
;
isExtraScreenSmall: Observable;
isScreenSmall: Observable;
private _subscriptions = new Subscription();
@@ -84,11 +73,6 @@ export class ComponentSidenav implements OnInit, OnDestroy {
this.isScreenSmall = breakpoints
.observe(`(max-width: ${SMALL_WIDTH_BREAKPOINT}px)`)
.pipe(map(breakpoint => breakpoint.matches));
-
- this.params = combineLatest(
- this._route.pathFromRoot.map(route => route.params),
- Object.assign,
- );
}
ngOnInit() {
@@ -120,12 +104,11 @@ export class ComponentSidenav implements OnInit, OnDestroy {
})
export class ComponentNav {
private _docItems = inject(DocumentationItems);
- readonly params = input();
+ private _route = inject(ActivatedRoute);
+ protected _params = this._route.params;
- items = toObservable(this.params).pipe(
- switchMap(params =>
- params?.section ? this._docItems.getItems(params.section) : Promise.resolve(null),
- ),
+ items = this._params.pipe(
+ switchMap(params => (params?.section ? this._docItems.getItems(params.section) : of([]))),
);
}