Enable and focus an Input element on button click


#1

I have a button which onclick enables an input element. what I need is first it gets enabled and then focus on that input element.
Here is my Input:
** input type=“text” id=‘destination’ ng-disabled="!locationAccepted" **

along with the normal button

Thanks in advance.


#2

in click event function within angular controller

locationAccepted = false;
angular.element( document.querySelector( ‘#destination’ ) ).trigger(‘focus’);