title: How to handle click events with @Directive?
body: <p>Is it possible to attach <code>click</code> events to the element on or within a <code>@Directive</code> (not <code>@Component</code>)?</p>
  <p>For example, I have a <code>@Directive</code> defined as follows:</p>
  <pre><code>import { Directive, OnInit, Input, ElementRef, Renderer } from '@angular/core';
  declare var $: any; // JQuery
  
  @Directive({
      selector: '[gridStack]'
  })
  export class GridStackDirective implements OnInit {
      @Input() w: number;
      @Input() animate: boolean;
  
      constructor(
          private el: ElementRef,
          private renderer: Renderer
      ) {
          renderer.setElementAttribute(el.nativeElement, &quot;class&quot;, &quot;grid-stack&quot;);
      }
  
      ngOnInit() {
          let renderer = this.renderer;
          let nativeElement = this.el.nativeElement;
          let animate: string = this.animate ? &quot;yes&quot; : &quot;no&quot;;
  
          renderer.setElementAttribute(nativeElement, &quot;data-gs-width&quot;, String(this.w));
          if(animate == &quot;yes&quot;) {
              renderer.setElementAttribute(nativeElement, &quot;data-gs-animate&quot;, animate);
          }
  
          let options = {
              cellHeight: 80,
              verticalMargin: 10
          };
  
          // TODO: listen to an event here instead of just waiting for the time to expire
          setTimeout(function () {
              $('.grid-stack').gridstack(options);
          }, 300);
      }
  
  }
  </code></pre>
  <p>In the HTML, where I use that <code>@Directive</code> (in <code>index.html</code>), note that I do not have any template associated with the <code>@Directive</code> itself, can I include a <code>click</code> event?:</p>
  <pre><code>&lt;div gridStack&gt;
      &lt;div&gt;&lt;a (click)=&quot;clickEvent()&quot;&gt;Click Here&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>I know this works if it is a <code>@Component</code>, but am looking to try to get it working with a <code>@Directive</code> if it is possible.</p>