0

I'm using modals in a angular project and I need to focus one field inside a modal.This field is part of a @component:

Autocomplete.html

<div #autocomplete>
    <input #input required>
    <ul class="list" *ngIf="isShow()">
        <li>...</li>
        <li>...</li>
    </ul>
</div>

And

Autocomplete.ts

@Component({
    selector: 'autocomplete',
    templateUrl: './autocomplete.html'
})
export class Autocomplete 
{
} 

This modal is call from another element of the same @component in the main view and when I clic in the first input, the modal has already been completely rendered so the ngAfterViewInit interface no help me.

Any ideas? Thanks

1 Answers1

0

Try to add some delay before set the input get focus. Please check this answer.

Indiana
  • 313
  • 4
  • 8