You can do this just passing the second input as a variable to the first one
For example
HTML
<!-- We pass focusable as a parameter to the processKeyUp function -->
<input (keyup)="processKeyUp($event, focusable)"/>
<!-- With #focusable we are creating a variable which references to the input -->
<input #focusable />
Later in your js/ts
@Component({
selector: 'plunker-app'
})
@View({
templateUrl: 'main.html'
})
class PlunkerApp {
constructor() {
}
processKeyUp(e, el) {
if(e.keyCode == 65) { // press A
el.focus();
}
}
}
el is the raw element, so you can use pure javascript on it.
Here’s a plnkr so you can see it working.
I hope it helps.