indrimuska / angular-selector

A native AngularJS directive that transform a simple <select> box into a full html select with typeahead.
http://indrimuska.github.io/angular-selector
MIT License
96 stars 36 forks source link

Focus on load? #65

Closed stephanebruckert closed 7 years ago

stephanebruckert commented 7 years ago

Hello,

I would like to do a focus() on api="countriesAPI" on page initialization. How would I do that?

Thanks!

indrimuska commented 7 years ago

Hi @stephanebruckert, assuming that you are using a similar piece of code to the one in the demo page, you just need to add this other piece to your controller:

$scope.$watch('countriesAPI', function (api) {
    api.focus();
});

Hope this could help you!