@@ -3,8 +3,8 @@ import {DOCUMENT} from '@angular/platform-browser';
33import { ActivatedRoute , NavigationEnd , Router } from '@angular/router' ;
44import { ScrollDispatcher , CdkScrollable } from '@angular/cdk/scrolling' ;
55import { Subject } from 'rxjs/Subject' ;
6- import 'rxjs/add/operator /filter' ;
7- import 'rxjs/add/operator /takeUntil' ;
6+ import { filter } from 'rxjs/operators /filter' ;
7+ import { takeUntil } from 'rxjs/operators /takeUntil' ;
88
99interface Link {
1010 /* id of the section*/
@@ -44,9 +44,10 @@ export class TableOfContents implements OnDestroy, OnInit {
4444 @Inject ( DOCUMENT ) private _document : Document ) {
4545
4646 // Create new links and save root url at the end of navigation
47- this . _router . events
48- . filter ( event => event instanceof NavigationEnd )
49- . takeUntil ( this . _destroyed )
47+ this . _router . events . pipe (
48+ filter ( event => event instanceof NavigationEnd ) ,
49+ takeUntil ( this . _destroyed ) ,
50+ )
5051 . subscribe ( event => {
5152 const rootUrl = _router . url . split ( '#' ) [ 0 ] ;
5253 if ( rootUrl !== this . _rootUrl ) {
@@ -57,7 +58,7 @@ export class TableOfContents implements OnDestroy, OnInit {
5758
5859 // Scroll to section when the fragment changes
5960 this . _route . fragment
60- . takeUntil ( this . _destroyed )
61+ . pipe ( takeUntil ( this . _destroyed ) )
6162 . subscribe ( fragment => {
6263 this . _urlFragment = fragment ;
6364 this . scrollFragmentIntoView ( ) ;
@@ -67,7 +68,7 @@ export class TableOfContents implements OnDestroy, OnInit {
6768 ngOnInit ( ) {
6869 // Update active link after scroll events
6970 this . _scrollDispatcher . scrolled ( )
70- . takeUntil ( this . _destroyed )
71+ . pipe ( takeUntil ( this . _destroyed ) )
7172 . subscribe ( scrollable =>
7273 this . _ngZone . run ( ( ) => {
7374 this . updateScrollContainer ( scrollable ) ;
0 commit comments