Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!

juniorsuporte2011 free asked 4 years ago


How do I change the focus from one matInput to another matInput using typeScript,

thankful

Joel Junior


Konrad Stępień staff answered 4 years ago


Hi @juniorsuporte2011,

This is one solution:

<div class="md-form">
  <input mdbInput type="text" id="form1" class="form-control" (click)="focusInput.focus()">
  <label for="form1" class="">Example label</label>
</div>


<div class="md-form">
  <input #focusInput mdbInput type="text" id="form2" class="form-control">
  <label for="form2" class="">Example label</label>
</div>

You can also use @ViewChild property in your ts code.

Best, Konrad.


juniorsuporte2011 free commented 4 years ago

thank you very much

Joel Junior



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 8.2.0
  • Device: DeskTop
  • Browser: chrome
  • OS: windows 10
  • Provided sample code: No
  • Provided link: No