【问题标题】:Ionic Popup button not visible离子弹出按钮不可见
【发布时间】:2016-07-27 18:55:31
【问题描述】:

我正在尝试使用 Ionic 框架来构建一个小应用程序,但是警报弹出窗口上没有按钮。由于某种原因,它不可见。

这就是它的样子 -

我的控制器 -

angular.module('starter.controllers', [])

.controller('DashCtrl', function($scope,$ionicPopup) {
$scope.users = {};
$scope.show = function() {
var popup = $ionicPopup.show({
 title: 'Don\'t eat that!',
 template: 'It might taste good'
});
};

})

请提出可能是什么原因?

谢谢。

【问题讨论】:

    标签: angularjs ionic-framework


    【解决方案1】:

    我不得不将 show 更改为 alert 并且它起作用了。

    $ionicPopup.show
    

    $ionicPopup.alert
    

    【讨论】:

      【解决方案2】:

      你可以在配置对象中添加按钮

      buttons: [
        { text: 'Cancel' }
      ]
      

      可以查看Here

      【讨论】:

        【解决方案3】:

        将您的代码更改为

        // An alert dialog
        $scope.showAlert = function() {
           var alertPopup = $ionicPopup.alert({
             title: 'Don\'t eat that!',
             template: 'It might taste good'
           });
        
           alertPopup.then(function(res) {
             console.log('Thank you for not eating my delicious ice cream cone');
           });
         };
        

        您缺少使按钮可用的$ionicPopup.alert,而不是$ionicPopup.show

        Reference

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2021-06-01
          • 1970-01-01
          • 2018-07-17
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-05-15
          相关资源
          最近更新 更多