import { ChangeDetectionStrategy , ChangeDetectorRef , Component , Input , OnInit , ViewEncapsulation } from '@angular/core' ; import { merge , Subject } from 'rxjs' ; import { takeUntil } from 'rxjs/operators' ; import { FuseNavigationService } from '@fuse/components/navigation/navigation.service' ; @ Component ( { selector : 'fuse-navigation' , templateUrl : './navigation.component.html' , styleUrls : [ './navigation.component.scss' ] } ) export class FuseNavigationComponent implements OnInit { @ Input ( ) layout = 'vertical' ; @ Input ( ) navigation : any ; private _unsubscribeAll : Subject < any > ; param { ChangeDetectorRef } _changeDetectorRef param { FuseNavigationService } _fuseNavigationService constructor ( private _changeDetectorRef , private _fuseNavigationService ) { this . _unsubscribeAll = new Subject ( ) ; } /**
     * On init
     */ ngOnInit ( ) { this . navigation = this . navigation || this . _fuseNavigationService . getCurrentNavigation ( ) ; this . _fuseNavigationService . onNavigationChanged . pipe ( takeUntil ( this . _unsubscribeAll ) ) . subscribe ( ( ) => { this . navigation = this . _fuseNavigationService . getCurrentNavigation ( ) ; this . _changeDetectorRef . markForCheck ( ) ; } ) ; merge ( this . _fuseNavigationService . onNavigationItemAdded , this . _fuseNavigationService . onNavigationItemUpdated , this . _fuseNavigationService . onNavigationItemRemoved ) . pipe ( takeUntil ( this . _unsubscribeAll ) ) . subscribe ( ( ) => { this . _changeDetectorRef . markForCheck ( ) ; } ) ; } }