title: Angular 2 Host Listener Change div heigtht
body: <p>I read the last couple of hours about Event Listener in Angular 2 but I think there is a big lack of documentation there.</p>
  
  <p>I want to set the height of different div groups (created in ngFor) to the one with the biggest height. Kinda like in <a href="https://stackoverflow.com/questions/28411021/set-height-of-one-div-to-another-div-in-angularjs">Angular 1 example</a></p>
  
  <p>I know that scope and <code>$watch</code> do not exist anymore. So I try to do it with Host Listener, but I cant find any good documentation for it. There are many tutorials for events <code>"click"</code>, <code>"mouseover"</code> etc. But none for other possible events. I need something like $watch or onChange. (No input fields, basic elements) Basiclly any documentation about the possible event names would help. </p>
  
  <p>Eventually there is also an example of the above link in angular2. </p>
  
  <p>PS: Found <code>'window: resize'</code> but <code>'div: resize'</code> not working. </p>
  
  <p>EDIT: With the help of maximus I got it done, here is the working code.</p>
  
  <p>Created a directives file: <h1>comments.directive.ts</h1></p>
  
  <pre><code>import { Directive, ElementRef, Input } from '@angular/core';
  import { DoCheck } from '@angular/core';
  
  @Directive({ selector: '[comments]' })
  
  export class CommentsDirective implements DoCheck{
  
      style: any;
  
      constructor(private element: ElementRef) {
  
      }
  
      ngDoCheck() {
          console.log(this.element);
          this.style = { //scope variable style, shared with our controller
              height:this.element.nativeElement.offsetHeight+'px', //set the height in style to our elements height
              width:this.element.nativeElement.offsetWidth+'px' //same with width
          };
      }
  }
  </code></pre>
  
  <p>Than I just imported it in NG-Module. </p>
  
  <p>HTML Part:</p>
  
  <pre><code>&lt;div comments [ngStyle]="style"&gt;
  </code></pre>
  
  <p>If I done the part with making it all equal height, based on the biggest, I will update it. </p>