When i'm running an application on Desktop or Android device, input focus is working fine. But it's not working in ios 10 Safari. I am using angularjs.
$timeout(function () {
var input = $element.find('.my-input-box')[0];
input.focus();
}, 500);
When i'm running an application on Desktop or Android device, input focus is working fine. But it's not working in ios 10 Safari. I am using angularjs.
$timeout(function () {
var input = $element.find('.my-input-box')[0];
input.focus();
}, 500);
I found this https://github.com/angular/material/issues/10080
may be this is helpful to you.
This link said may be it is event/gestured problem.
No need to find the element.You can add a directive instead.
yourApp.directive('autofocus', ['$timeout', function($timeout) {
return {
restrict: 'A',
link : function($scope, $element) {
$timeout(function() {
$element[0].focus();
});
}
}
}]);
and use like :-
<input autofocus type="text"/>