title: angular function on recursive child element click
body: <p>I'm trying to call a function generated by recursive @Input decorator. The problem is, <code>(click)</code> event doesn't affects children. Only parents elements clicks emits an event.</p>
  
  <pre><code>import { Component, Input, Output, EventEmitter } from '@angular/core';
  import {AdminCategory} from './admin-category.component'
  
  @Component({
    selector: 'categories',
    template: `
       &lt;div *ngFor="let cat of categories"&gt;
        &lt;ul&gt;
         &lt;li&gt;
           &lt;span (click)="addCategory(cat)"&gt;{{cat.name}}&lt;/span&gt;
           &lt;categories [categories]="cat.children" &lt;/categories&gt;
         &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    `,
  })
  export class TreeView {
    @Input() categories;
    @Output() category: EventEmitter&lt;AdminCategory&gt; = new EventEmitter&lt;AdminCategory&gt;();
  
    addCategory(category: AdminCategory){
      this.category.emit(category);
    }
  }
  </code></pre>
  
  <p>I found somewhere here on SO (unfortunately cannot find link now) that adding an <code>($event)</code> should resolve issue, so I tried this:</p>
  
  <pre><code>import { Component, Input, Output, EventEmitter } from '@angular/core';
  import {AdminCategory} from './admin-category.component'
  
  @Component({
    selector: 'categories',
    template: `
       &lt;div *ngFor="let cat of categories"&gt;
        &lt;ul&gt;
         &lt;li&gt;
           &lt;span (click)="addCategory(cat)"&gt;{{cat.name}}&lt;/span&gt;
           &lt;categories [categories]="cat.children" (clickEvent)="onClickChild($event)"&gt; asd&lt;/categories&gt;
         &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    `,
  })
  export class TreeView {
    @Input() categories;
    @Output() category: EventEmitter&lt;AdminCategory&gt; = new EventEmitter&lt;AdminCategory&gt;();
  
    addCategory(category: AdminCategory){
      this.category.emit(category);
    }
  
    onClickChild(event){
      console.log("asdas");
      this.category.emit(event);
    }
  }
  </code></pre>
  
  <p>But without any results, <code>console.log("asdas");</code> never happens. Does someone know  cause of this problem? What I'm doing wrong?</p>