I am having some issues in a form I am creating. This form:
<form name="myForm">
<label ng-hide="hide" class="item item-input" >
<span class="input-label">How much minutes?</span>
<input ng-pattern="onlyNumbers" name="number" type="text" ng-model="taskMinutes">
</label>
</form>
Is almost in the middle of the screen but when the user taps on the input field to start typing, the focus is not being correctly executed. The keyboard shows but it is hiding the field. If I start typing, the focus gets executed and the screen moves accordingly. Any tips on how I can fix this?
Update: This is the whole screen:
<ion-view>
<ion-content>
<div class="list">
<label class="item item-input">
<span class="input-label">Task</span>
<input type="text" ng-model="taskInfo">
</label>
<label class="item "> Can this task be measured?
<p>
<ion-checkbox ng-repeat="item in devList"
ng-model="item.checked"
ng-checked="item.checked"
ng-click="change(item)">
{{ item.text }}
</ion-checkbox>
</p>
</label>
<form name="myForm">
<label ng-hide="hide" class="item item-input" >
<span class="input-label">How much minutes?</span>
<input ng-pattern="onlyNumbers" name="number" type="tel" ng-model="taskMinutes">
</label>
</form>
<label class="item" ng-controller="tasksCtrl">
<button ng-disabled="!myForm.number.$valid" class="button button-block button-royal" type="submit" ng-click="addTask()">Add Task</button>
</label>
</div>
The way that I found was to add the class
hide-on-keyboard-open
of ionic in all components that doesn't uses the keyboard. So this way I do not need to scroll the page cause with this components hidden I can see all I need to do with the keyboard open.Solved for ionic V1. Just add the fixed as below.
Add "delegate-handle" in the template file.
then add function on input field for animate when keyboard open.
Add the injectable dependency inside the controller
Make sure to include the ionic keyboard latest version. currently, I used "com.ionic.keyboard": "2.2.1",
For native scrolling, Add the code in app.js
Enjoy..
This is how I solved it:
NOTE: you have to install cordova keyboard plugin (https://github.com/driftyco/ionic-plugin-keyboard)
and on application run:
and in the template:
I was having this exact issue yesterday!
Each of the elements on the page had lots of different padding declarations that were conflicting and this broke my form.
Please try removing all styling from the page to see if this fixes it. If it does, add back the styling element-by-element to pinpoint which one is breaking your form.
Hope this helps!
Without Using Any Plugin
This worked for me and currently using in more than 10 apps
NOTE : Please specify reason in comment For Vote Down
<ion-view>
Is not ScrollableBut
<ion-content>
Is ScrollableSo when you scroll its
<ion-content>
that scrolls and<ion-view>
is DEAD , STIFF Never scrolls