79734431

Date: 2025-08-13 14:53:27
Score: 1
Natty:
Report link

I found it much easier to assign a class to the input field (in my case they are created dynamically).

<input
  class="d-inline texts"
  matInput
  formControlName="text"
>

Then I just applied the following pure javascript to autofocus on the last input field created:

    setTimeout(() => {
      const elementsByClassName: any = document.getElementsByClassName('texts');
      elementsByClassName.item(elementsByClassName.length - 1).focus();
    }, 0);

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: tr8er