import { AfterContentInit , Component , ContentChildren , ElementRef , HostBinding , QueryList , Renderer2 , ViewEncapsulation } from '@angular/core' ; import { FuseWidgetToggleDirective } from './widget-toggle.directive' ; @ Component ( { selector : 'fuse-widget' , templateUrl : './widget.component.html' , styleUrls : [ './widget.component.scss' ] , encapsulation : ViewEncapsulation . None } ) export class FuseWidgetComponent implements AfterContentInit { @ HostBinding ( 'class.flipped' ) flipped = false ; @ ContentChildren ( FuseWidgetToggleDirective , { descendants : true } ) toggleButtons : QueryList < FuseWidgetToggleDirective > ; param { ElementRef } _elementRef param { Renderer2 } _renderer constructor ( private _elementRef , private _renderer ) { } /**
     * After content init
     */ ngAfterContentInit ( ) { setTimeout ( ( ) => { this . toggleButtons . forEach ( flipButton => { this . _renderer . listen ( flipButton . elementRef . nativeElement , 'click' , ( event ) => { event . preventDefault ( ) ; event . stopPropagation ( ) ; this . toggle ( ) ; } ) ; } ) ; } ) ; } /**
     * Toggle the flipped status
     */ toggle ( ) { this . flipped = ! this . flipped ; } }