Monday, 3 April 2017

Angular2 click event not working

I'm facing an issue with an angular2 click event, it's not launching a simple console.log or an alert.

Here I post my component template:

<div class="col-md-4">
<div *ngFor="let phone of phones">

</div>
<input class="form-control" type="text" [(ngModel)]="phone"/>
<button class="btn btn-primary" (click)="console.log('clicked');" type="button">Call</button>
</div>

When I click the button, there is nothing in the console.

I tried to execute a component function, with no luck as well.

I'm doing it the same way than here: http://learnangular2.com/events/

Do you guys need more files? I just don't understand why this is not working

Thank you so much, Daniel



via DaRo

No comments:

Post a Comment