@@ -9,12 +9,12 @@ import {
99 ElementRef ,
1010 ChangeDetectorRef ,
1111 TrackByFunction ,
12- HostListener ,
1312 OnDestroy ,
1413} from '@angular/core' ;
15- import { ActivatedRoute , RouterLink } from '@angular/router' ;
16- import { NgIf , NgFor } from '@angular/common' ;
14+ import { ActivatedRoute , RouterLink , UrlSegment } from '@angular/router' ;
15+ import { NgIf , NgFor , AsyncPipe } from '@angular/common' ;
1716import { CdkObserveContent } from '@angular/cdk/observers' ;
17+ import { Observable } from 'rxjs' ;
1818
1919export interface ContentPageAnchor {
2020 id : string ;
@@ -65,7 +65,7 @@ function getAnchorTitleText(element: Element): string {
6565 styleUrls : [ './content.component.scss' ] ,
6666 changeDetection : ChangeDetectionStrategy . OnPush ,
6767 standalone : true ,
68- imports : [ CdkObserveContent , NgIf , RouterLink , NgFor ] ,
68+ imports : [ CdkObserveContent , NgIf , RouterLink , NgFor , AsyncPipe ] ,
6969} )
7070export class ContentComponent implements OnInit , OnDestroy {
7171 private _anchorEventListenerCleanupFns : ( ( ) => void ) [ ] = [ ] ;
@@ -77,6 +77,7 @@ export class ContentComponent implements OnInit, OnDestroy {
7777 @ViewChild ( 'mainContent' , { static : true } )
7878 mainContent ?: ElementRef < HTMLElement > ;
7979
80+ readonly currentUrl$ : Observable < UrlSegment [ ] > ;
8081 readonly trackBy : TrackByFunction < ContentPageAnchor > ;
8182 readonly canShare = ( window as any ) . navigator . canShare
8283 ? ( window as any ) . navigator . canShare ( { url : window . location . href } )
@@ -87,6 +88,7 @@ export class ContentComponent implements OnInit, OnDestroy {
8788 private cdr : ChangeDetectorRef ,
8889 route : ActivatedRoute ,
8990 ) {
91+ this . currentUrl$ = route . url ;
9092 this . trackBy = ( index , item ) => {
9193 return item . id ;
9294 } ;
0 commit comments