【问题标题】:Ionic Popup blocking ng-click in ionic modalIonic Popup 在离子模式中阻止 ng-click
【发布时间】:2017-03-10 08:11:44
【问题描述】:

Plunkr:Click here

我有一个如下的 plunker。我有两种方式显示ionic modal
1) 点击按钮直接显示离子模态。
2) 点击按钮显示离子弹窗,然后点击另一个按钮显示离子模态。

请注意,在情况 (1) 中,我可以通过单击左上角按钮来关闭离子模式,但在情况 (2) 的情况下则不行。

注意:
1) 当离子模式在 (2) 中打开时,离子弹出窗口应保留
2) backDropClickToClose 必须设置为 false。

为了在离子弹出窗口上方制作离子模态,我使用了以下 css:

.modal-backdrop {
  z-index: 13 !important;
}

我的怀疑是某些 css 阻止了 (2) 中打开的模式被点击。也许某种z-index。希望有人能在这方面提供帮助。

【问题讨论】:

    标签: angularjs css ionic-framework


    【解决方案1】:

    在 index.html 文件中包含 jquery 插件

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    

    在controller.js 中添加一行来移除popup-open 类。

    $scope.showPopup = function() {
      var myPopup = $ionicPopup.show({
        template: '',
        title: 'Popup',
        scope: $scope,
        buttons: [
          { text: 'Cancel' },
          {
            text: '<b>Show Modal Dialog</b>',
            type: 'button-positive',
            onTap: function(e) {
              $('body').removeClass('popup-open');
              $scope.openModal();
              e.preventDefault();
            }
          }
        ]
      });
    };
    

    将 controller.js 中的 closeModal 函数替换为以下代码。

    $scope.closeModal = function() {
        $('body').removeClass('modal-open');
        $scope.modal.hide();
      };
    

    【讨论】:

    • 在 index.html 文件 IN 控制器中包含
    猜你喜欢
    • 2017-02-26
    • 1970-01-01
    • 1970-01-01
    • 2016-12-30
    • 1970-01-01
    • 2015-04-08
    • 2016-04-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多