2016-11-03 83 views
0

我有一個使用Angular的phonegap應用程序。我遇到的問題是我想讓用戶在模態內的表單中輸入他們的電子郵件。Phonegap如何自動顯示鍵盤

$scope.email = function() { 

    $uibModal.open({ 
     animation: true, 
     templateUrl: 'views/modals/sales/email.html', 
     size: "md", 
     windowClass: 'center-modal', 
     controller: function ($scope, $uibModalInstance) { 

      //$("#email").focus(); 

      $scope.submit = function() { 

      }; 

      $scope.close = function() { 
       $uibModalInstance.dismiss('cancel'); 
      } 
     } 
    }); 

}; 

現在該模板的模板是這樣的。

<div class="panel panel-primary"> 
    <form name="form" ng-submit="submit(form)" novalidate> 
     <div class="panel-body"> 
      <div class="col-md-12"> 
       <h3 class="text-center">Please enter your email</h3> 
      </div> 
      <div class="form-group col-md-12"> 
       <input type="email" class="form-control btn-block input-lg" ng-model="customer.email" id="email" autofocus> 
      </div> 

      <div class="col-md-3 col-md-offset-6"> 
       <button class="btn btn-default btn-block btn-lg" type="button" ng-click="close()">Close</button> 
      </div> 
      <div class="col-md-3"> 
       <button class="btn btn-primary btn-block btn-lg" type="submit" ng-click="submit()">Send</button> 
      </div> 
     </div> 
    </form> 
</div> 

,當你可以看到輸入型電子郵件必須是焦點,當模態開拓,而是我的投入越來越焦點,但在虛擬鍵盤上的iOS沒有顯示出來,直到我手動輕按問題輸入。

如何在模式打開時顯示虛擬鍵盤。

謝謝。

回答