Angu Angu - 1 year ago 172
Android Question

ionic keyboard focus on input box issue

I am using angular with ionic

I have used below code

<input type="number" name="foo" ng-model="field.field_value" class="form-number" ng-focus="keyboardFocus(this)" >

var a= $(t).attr('class');
// $ionicScrollDelegate.scrollBottom();
// $ionicScrollDelegate.$getByHandle(t).scrollTop();

But scroll is not working in current position on textbox. keyboard focus on textbox is not working but type any text foucus is working

Answer Source

Imho, no need to use $ionicScrollDelegate, change position, scroll manually or any other complicated stuff.

You just need the Ionic Keyboard Cordova plugin to be installed. See the explanation here.

To install it: cordova plugin add com.ionic.keyboard

Nothing else to do. On focus, the page will move automatically.

Of course, it will work only on real devices, but in my experience, with this plugin, focused form elements are never hidden under the keyboard.