Ionic Framework Keyboard hides input field

后端 未结 5 1606
悲&欢浪女
悲&欢浪女 2020-12-21 13:51

I am having some issues in a form I am creating. This form:

  
5条回答
  •  甜味超标
    2020-12-21 14:27

    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

        angular.module('starter.user', []).controller('userCtrl', function($scope, $state, $http, $ionicScrollDelegate) {
             ....
             $scope.scrollUP = function () {
                 if ( app.isAndroid() ) {
                    document.querySelector("#user").scrollIntoView(false);
                 }
             }
             $scope.keyboardFocus=function(handleValue){
                 if ( app.isAndroid() ) { //check for android platform
                    $timeout(function(){
                        $ionicScrollDelegate.$getByHandle(handleValue).scrollBottom();
                   }, 500);
                 }
              }
        });
    

    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

        .config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
            $ionicConfigProvider.platform.android.scrolling.jsScrolling(true);
        .....
        }
    

    Enjoy..

提交回复
热议问题