F
F
Finsh2017-03-10 13:40:38
Angular
Finsh, 2017-03-10 13:40:38

How to access an element in ng2?

How to access an element (input) by id and call focus() when clicking on another button?

<button (click)="этотМетодДолженУстановитьФокусНаИнпут()">На эту кнопку надо нажать<button>

<form #formVar="ngForm" (ngSubmit)="методДляОбработкиМоейФормы(formVar.value)> 
     <input id="нужный-мне-инпут" type="text">
     <input  type="text">
     <input  type="text">
</form>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2017-03-10
@Finsh

Example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question