title: ERROR TypeError: _co.onCLk is not a function
body: <p>Trying one code in Angular 2 its HTML is running but angular code is not executing it says the value which i am passing from html is not a function. Please help!</p>
  
  <p>HTML: app.html - i am trying to show the student details. I have a list of items in angular app.component.ts file which i am calling on HTML page which is working fine. But when i am passing a value on a click event to app.component.ts fine its giving error and showing on console that this is not a function.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class ="card search"&gt;
      &lt;h1 class = "search-headline"&gt; Student Directory&lt;/h1&gt;
      &lt;label class = "search-label"&gt; Search 
          &lt;span *ngIf = "name"&gt;for: {{ name }}&lt;/span&gt;&lt;/label&gt;
          &lt;input class = "search-input" #newStudent&gt;
          &lt;button class ="btn"
          (click)="addstudent(newstudent.value)"
          &gt;Add&lt;/button&gt;
  &lt;/div&gt;
  
  &lt;ul class="studentlist cf"&gt;
  &lt;li class="studlist-item cf" *ngFor="let stud of students" (click)="onClk($event)"&gt;
      &lt;h2 class="student-name"&gt;{{ stud.name }}&lt;/h2&gt;
      &lt;h3 class="student-emp"&gt;{{ stud.Empname }}&lt;/h3&gt;
  &lt;/li&gt;
  &lt;/ul&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Angular component.app.ts: Here i am defining variables and add click event to show name i am clicking from the html to show on UI. At the same time i have given a ability to add more names to the already added list on the UI.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import { Component } from '@angular/core';
  
  @Component({
    selector: 'app',
    templateUrl: './partials/app.html'
  })
  
  export class AppComponent {
    name: string;
    students: any;
    event: any;
  
    onClk(event){
     this.name = event.target.innerHTML;
    }
  
    addstudent(value){
      if(value!=' '){
        this.students.push({
          name: value,
          Empname: 'xyz'
        });
      }
    }
  
    constructor(){
    this.students = [
      {
        name: 'Robin',
        Empname: 'abc' 
      },{
        name: 'Jack',
        Empname: 'Bcd' 
      },{
        name: 'John',
        Empname: 'Cde' 
      }
    ]
    }
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Getting error message on console when i run the code: Type error i am getting here is onCLK is not a function. Its a function which is returning value form HTML to app.component.ts file and from there we are getting the value we clicked. Also getting many other errors not sure what does that mean?</p>
  
  <pre><code>app.html:12 ERROR TypeError: _co.onCLk is not a function
  at Object.eval [as handleEvent] (app.html:12)
  at handleEvent (view.ts:142)
  at callWithDebugContext (services.ts:815)
  at Object.debugHandleEvent [as handleEvent] (services.ts:411)
  at dispatchEvent (util.ts:185)
  at eval (element.ts:238)
  at HTMLLIElement.eval (dom_renderer.ts:75)
  at ZoneDelegate.invokeTask (zone.js:425)
  at Object.onInvokeTask (ng_zone.ts:288)
  at ZoneDelegate.invokeTask (zone.js:424)
  </code></pre>