import { Directive , ElementRef , EventEmitter , Output , OnInit } from "@angular/core" ; @ Directive ( { selector : "[HeightDirective]" , host : { '(window:resize)' : 'onResize($event)' , } , } ) export class HeightDirective implements OnInit { @ Output ( ) resizing = new EventEmitter < number > ( false ) ; constructor ( private el ) { } ngOnInit ( ) { this . onResize ( null ) ; } private onResize ( e ) { let height = this . el . nativeElement . clientHeight ; this . resizing . emit ( height ) ; } }