import { Component , HostBinding , HostListener , Input , OnDestroy , OnInit } from '@angular/core' ; import { Subject } from 'rxjs' ; import { takeUntil } from 'rxjs/operators' ; import { fuseAnimations } from '@fuse/animations' ; import { FuseConfigService } from '@fuse/services/config.service' ; @ Component ( { selector : 'fuse-nav-horizontal-collapsable' , templateUrl : './collapsable.component.html' , styleUrls : [ './collapsable.component.scss' ] , animations : fuseAnimations } ) export class FuseNavHorizontalCollapsableComponent implements OnInit , OnDestroy { fuseConfig : any ; isOpen = false ; @ HostBinding ( 'class' ) classes = 'nav-collapsable nav-item' ; @ Input ( ) item : any ; private _unsubscribeAll : Subject < any > ; constructor ( private _fuseConfigService ) { this . _unsubscribeAll = new Subject ( ) ; } /**
     * On init
     */ ngOnInit ( ) { this . _fuseConfigService . config . pipe ( takeUntil ( this . _unsubscribeAll ) ) . subscribe ( ( config ) => { this . fuseConfig = config ; } ) ; } /**
     * On destroy
     */ ngOnDestroy ( ) { this . _unsubscribeAll . next ( ) ; this . _unsubscribeAll . complete ( ) ; } /**
     * Open
     */ @ HostListener ( 'mouseenter' ) open ( ) { this . isOpen = true ; } /**
     * Close
     */ @ HostListener ( 'mouseleave' ) close ( ) { this . isOpen = false ; } }