import { ChangeDetectorRef , Component , HostBinding , Input , OnDestroy , OnInit } from '@angular/core' ; import { merge , Subject } from 'rxjs' ; import { takeUntil } from 'rxjs/operators' ; import { FuseNavigationItem } from '@fuse/types' ; import { FuseNavigationService } from '@fuse/components/navigation/navigation.service' ; @ Component ( { selector : 'fuse-nav-vertical-item' , templateUrl : './item.component.html' , styleUrls : [ './item.component.scss' ] } ) export class FuseNavVerticalItemComponent implements OnInit , OnDestroy { @ HostBinding ( 'class' ) classes = 'nav-item' ; @ Input ( ) item : FuseNavigationItem ; private _unsubscribeAll : Subject < any > ; /**
     * Constructor
     */ param { ChangeDetectorRef } _changeDetectorRef param { FuseNavigationService } _fuseNavigationService constructor ( private _changeDetectorRef , private _fuseNavigationService ) { this . _unsubscribeAll = new Subject ( ) ; } /**
     * On init
     */ ngOnInit ( ) { merge ( this . _fuseNavigationService . onNavigationItemAdded , this . _fuseNavigationService . onNavigationItemUpdated , this . _fuseNavigationService . onNavigationItemRemoved ) . pipe ( takeUntil ( this . _unsubscribeAll ) ) . subscribe ( ( ) => { this . _changeDetectorRef . markForCheck ( ) ; } ) ; } /**
     * On destroy
     */ ngOnDestroy ( ) { this . _unsubscribeAll . next ( ) ; this . _unsubscribeAll . complete ( ) ; } }