Angular 2 Error during evaluation of "click" following the tutorial
<p>I was following <a href="https://angular.io/docs/ts/latest/tutorial/toh-pt2.html" rel="nofollow">this part of the tutorial</a> for AngularJS 2, but when I try to select a "hero" element from the list I receive errors like:</p>

<pre><code>EXCEPTION: Error during evaluation of "click"
ORIGINAL EXCEPTION: TypeError: l_context.onSelect is not a function
</code></pre>

<p>This is the part of the template with the click binding:</p>

<pre><code>&lt;ul class="heroes"&gt;
   &lt;li *ngFor="#hero of heroes"
      [class.selected]="hero === selectedHero"
      (click)="onSelect(hero)"&gt;
      &lt;span class="badge"&gt;{{hero.id}}&lt;/span&gt; {{hero.name}}
   &lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>and this is the class AppComponent where I define the onSelect function:</p>

<pre><code>export class AppComponent {
  title = 'Tour of Heroes';
  heroes = HEROES;
  selectedHero: Hero;

  onSelect(hero: Hero) { this.selectedHero = hero; }
}
</code></pre>

<p>I even tried to copy the code exactly how it is in the tutorial but still receive the errors. What's wrong?</p>