How do you autofocus on an input text field that makes keyboard showing up when enter the page

I got a modal with just an input textarea. I want to make the keyboard popup automatically with cursor focused on the input as soon as the page launches.
I tried to add autofocus on the html, does not work
Also I tried:


I got weird issue on iphone.

How do I do that?

1 Like

So it’s probably best not to use autofocus.
Autofocus behaves very differently across platforms and can cause a lot of issues, especially on mobile. You might want to avoid it

Exactly the same circumstances and the same problem here.
If you finally find a solution, please share it. :wink:


Found any solutions ?

Here is a directive I found that seems to work well on both Android and iOS.

.directive('focusMe', ['$timeout', function ($timeout) {
	return {
		link: function (scope, element, attrs) {
			if (attrs.focusMeDisable === true) {
			$timeout(function () {
				if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {; //open keyboard manually
			}, 350);


<input type="text" focus-me focus-me-disable="showInput" ></textarea>

Also found this one, but havent tried it.

Just search angular focusme.

Good Luck


Finally found a solution !!

Or you can try my solution:

Thanks Dude. Thank you soo much.