Topic: focus matInput
juniorsuporte2011 asked 5 years ago
How do I change the focus from one matInput to another matInput using typeScript,
thankful
Joel Junior
Konrad Stępień staff answered 5 years ago
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.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: 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