简体   繁体   English

自定义离子框架弹出窗口

[英]Custom Ionic Framework Popup

I have an IONIC popup, See image below in the link. 我有一个IONIC弹出窗口,请参见下面的链接图片。

I have an issue when i click on the buttons Arrange Coupon, It redirect me to the next screen. 单击“安排优惠券”按钮时出现问题,它将我重定向到下一个屏幕。 It is fine.But the popup doesn't hide. 很好。但是弹出窗口不会隐藏。 Please help me. 请帮我。

Thanks. 谢谢。

http://awesomescreenshot.com/0e55lzsl39 http://awesomescreenshot.com/0e55lzsl39

var myPopup;
$scope.showPopup = function() {
 myPopup = $ionicPopup.show({

    template: '<a class="button button-block button-energized" href="#/redeem">Arrange Coupon</a> <a class="button button-block button-balanced">Add Coupon</a> ',

    title: 'Coupon Management',

    buttons: [{

       text: '<b>OK</b>',

       type: 'button button-small button-positive',

       onTap: function(e) {

       }

    }, ]

 });
 myPopup.then(function(res) {
    if (res) {

          console.log(res);
    }
    else{
      alert('here');
    }

 });

}; };

Looks like you forgot to add the image. 您好像忘记了添加图像。 However, The Ionic Popup service allows programmatically creating, showing and closing popup. 但是,Ionic Popup服务允许以编程方式创建,显示和关闭弹出窗口。 If you have a popup defined like this, 如果您定义了这样的弹出窗口,

var myPopup = $ionicPopup.show({
template: '<input type="password" ng-model="data.wifi">',
title: 'Enter Wi-Fi Password',
subTitle: 'Please use normal things',
scope: $scope,
buttons: [
  { text: 'Cancel' },
  {
    text: '<b>Save</b>',
    type: 'button-positive',
    onTap: function(e) {
      if (!$scope.data.wifi) {
        //don't allow the user to close unless he enters wifi password
        e.preventDefault();
      } else {
        return $scope.data.wifi;
      }
    }
  }
]
});

You can close it like this 您可以像这样关闭

myPopup.close();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM