matchi
matchi

Reputation: 593

What is the angular2 event for pressing 'Enter'

I have a refresh icon that is accessible (can be reached by tabbing), but the event trigger to refresh is (click), but this is not triggered when the focus is on the icon and enter is pressed. What is the event trigger for that called?

Code:

<span (click)="refresh()" tabindex="0" role="button"></span>

Upvotes: 11

Views: 9103

Answers (2)

Abdul
Abdul

Reputation: 1208

(keydown)="someFun()"

Ex:

<input type="text" class="form-control" [(ngModel)]="userName" (keydown)="userNameEntered()">

Upvotes: 0

Obed Amoasi
Obed Amoasi

Reputation: 2039

(keyup.enter)="somefunction()"

this is the event for enter

Upvotes: 26

Related Questions