Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how set focus in angular md-autocomplete?

I have a dialog with few field to set, the first field is a md-autocomplete, when I click ok all these fields are cleaned, so, I want set focus true in the md-autocomplete, for starting to filling data again.

like image 457
mos Avatar asked Jun 15 '16 05:06

mos


1 Answers

You can do that by adding attribute

md-autofocus

an example:

<md-autocomplete md-autofocus md-selected-item="selectedItem" md-search-text="searchText" md-items="item in getMatches(searchText)" md-item-text="item.display">
    <span md-highlight-text="searchText">{{item.display}}</span>
</md-autocomplete>

ref : here

Regards.

like image 131
Hardik Vaghani Avatar answered Oct 08 '22 18:10

Hardik Vaghani