How can I handle a Tab keypress
event in Angular 2?
I took this from the Angular docs to get the keyCode
. It works well when I press the other keys, but when I press Tab nothing happens.
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<input (keyup)="onKey($event)">
<p>{{values}}</p>`
})
export class AppComponent {
values = '';
onKey(event: any) {
this.values += event.keyCode+ ' | ';
}
}
Also, is this the correct way to do it in Angular 2?
<input ng-keydown="($event.keyCode == 9) &&
signal('something')" />