【问题标题】:Show keyboard on Show of Modal Ionic - AngularJS在模态离子的显示上显示键盘 - AngularJS
【发布时间】:2016-08-20 02:48:24
【问题描述】:

我有一个包含文本区域的模式视图,当显示模式时,我希望键盘出现。这是我的代码

$ionicModal.fromTemplateUrl('templates/inputtextarea.html', {
              scope: $scope,
              animation: 'slide-in-up'
        }).then(function(modal) {
            $scope.modal = modal;
            $scope.modal.show().then(document.getElementById("textarea").focus());
            document.getElementById("textarea").maxLength = 256;
        });

第一次显示模态时显示键盘,但是当我关闭模态然后再次显示以更新textarea中的文本时,键盘不显示?为什么是第一次显示,而不是第二次、第三次等......我怎样才能在每次显示模态时显示它?

谢谢

【问题讨论】:

    标签: javascript angularjs ionic-framework angular-ui-bootstrap


    【解决方案1】:

    尝试在模态关闭功能上删除模态。这也意味着每次调用模态打开函数时都必须调用并创建模态

    $scope.closeModal = function() {
        $scope.modal.hide();
        $scope.modal.remove();
    };
    

    【讨论】:

      猜你喜欢
      • 2014-10-15
      • 2015-12-15
      • 2011-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多