S
S
sdgroup142018-09-14 18:45:46
Angular
sdgroup14, 2018-09-14 18:45:46

How to autofocus on input in ngfor?

In general, there are a bunch of inputs in ngfor. In addition, they are added dynamically. Every time I need to focus on the last one after the previous one answered, what should I do? autofocus crashes for some reason. doesn't work for everyone

<div ngfor="let inp of inputs">
<input type="text"/>
</div>

inputs = [];

sendHandler(input){
    this.api.sendHandler......................
}

ngOnInit(){
    this.api...... subscribe(data =.> this.inputs.push(data) )
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2018-09-22
@sdgroup14

can help you https://angular.io/api/core/ChangeDetectorRef

S
sim3x, 2015-04-01
@oxeed

getbootstrap.com/javascript/#tabs
+
height change animation for block inside
stackoverflow.com/a/8331169/1346222

T
Twelfth Doctor, 2015-04-05
@verdex

You can use the ready-made paid Ubermenu plugin and its extensions. The plugin is paid.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question