@@ -3,8 +3,8 @@ import {DOCUMENT} from '@angular/platform-browser';
3
3
import { ActivatedRoute , NavigationEnd , Router } from '@angular/router' ;
4
4
import { ScrollDispatcher , CdkScrollable } from '@angular/cdk/scrolling' ;
5
5
import { 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' ;
8
8
9
9
interface Link {
10
10
/* id of the section*/
@@ -44,9 +44,10 @@ export class TableOfContents implements OnDestroy, OnInit {
44
44
@Inject ( DOCUMENT ) private _document : Document ) {
45
45
46
46
// 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
+ )
50
51
. subscribe ( event => {
51
52
const rootUrl = _router . url . split ( '#' ) [ 0 ] ;
52
53
if ( rootUrl !== this . _rootUrl ) {
@@ -57,7 +58,7 @@ export class TableOfContents implements OnDestroy, OnInit {
57
58
58
59
// Scroll to section when the fragment changes
59
60
this . _route . fragment
60
- . takeUntil ( this . _destroyed )
61
+ . pipe ( takeUntil ( this . _destroyed ) )
61
62
. subscribe ( fragment => {
62
63
this . _urlFragment = fragment ;
63
64
this . scrollFragmentIntoView ( ) ;
@@ -67,7 +68,7 @@ export class TableOfContents implements OnDestroy, OnInit {
67
68
ngOnInit ( ) {
68
69
// Update active link after scroll events
69
70
this . _scrollDispatcher . scrolled ( )
70
- . takeUntil ( this . _destroyed )
71
+ . pipe ( takeUntil ( this . _destroyed ) )
71
72
. subscribe ( scrollable =>
72
73
this . _ngZone . run ( ( ) => {
73
74
this . updateScrollContainer ( scrollable ) ;
0 commit comments