I have the following code below, which is supposed to open a modal with an input box as soon as you start typing. I have made progress to the point where the modal opens, however I can't figure out how to focus on the actual input box (inside my link function in the directive). Any ideas would be appreciated. Also, if there are any other suggestions for improvements, please let me know.
Please see this plnkr http://plnkr.co/edit/ZMN56G
link: function(scope, elem, attrs){
//CAN'T FIGURE THIS OUT
var input = elem.children()[1]
input.focus();
console.log(input)
}
And HTML....
<div class="modal-body">
<input type="text" ng-model="selected.query"/>
Selected: <b>{{ query}}</b>
</div>