I was following [this part of the tutorial](https://angular.io/docs/ts/latest/tutorial/toh-pt2.html) for AngularJS 2, but when I try to select a "hero" element from the list I receive errors like:

```
EXCEPTION: Error during evaluation of "click"
ORIGINAL EXCEPTION: TypeError: l_context.onSelect is not a function

```

This is the part of the template with the click binding:

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

```

and this is the class AppComponent where I define the onSelect function:

```
export class AppComponent {
  title = 'Tour of Heroes';
  heroes = HEROES;
  selectedHero: Hero;

  onSelect(hero: Hero) { this.selectedHero = hero; }
}

```

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