*There are a lot of similar questions but I have not found a true duplicate that answers my question Apologies if I missed something.
I have a page with several inputs
How about to use a data-attribute with id and get the input from it?
// component constructor
constructor(
private readonly elementRef: ElementRef,
// ...
) {
// ...
}
focusOnInput(event: MouseEvent): void {
const groupId = (event.target).dataset.group;
const input = this.elementRef.nativeElement.querySelector(`input[data-group="${groupId}"]`);
input.focus();
}