I have a piece of code generated inside of an *ngFor, and a span with a (click) event that I can't figure why it does not fire when I click it. It does not print anything in the console.
Can this be because of the ngFor or ngIf ? I've tried everything I can think of...
My template looks like this (the relevant part):
<tbody>
<ng-container *ngIf="matches">
<tr *ngFor="let meci of matches">
<td>{{ meci.id }}</td>
<td>{{ meci.echipa1 }}</td>
<td>{{ meci.echipa2 }}</td>
<td>{{ meci.tip }}</td>
<td>{{ meci.pretBilet }}</td>
<td>{{ meci.nrLocuri }}</td>
<td>{{ meci.data }}</td>
<td class="ui center aligned">
<span class="fas fa-trash red icon"></span>
<span class="fas fa-edit teal icon" (click)="edit(meci)"></span>
</td>
</tr>
</ng-container>
</tbody>
And the component like this:
export class MatchesComponent implements OnInit {
matches: Meci[];
constructor(private service: MatchesService, private modalService: SuiModalService) { }
ngOnInit() {
this.service.getAll().subscribe(matches => this.matches = matches);
}
edit(meci: Meci) {
console.log('edit');
}
}
