2016-02-06 88 views
0

我有一个IONIC弹出框,请参阅下面的链接。定制离子框架弹出框

我有一个问题,当我点击按钮安排优惠券,它将我重定向到下一个屏幕。这很好,但弹出窗口不会隐藏。请帮帮我。

谢谢。

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'); 
    } 

}); 

};

回答

0

看起来你忘了添加图像。但是,离子弹出服务允许以编程方式创建,显示和关闭弹出窗口。 如果你有一个像这样定义一个弹出,

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; 
     } 
    } 
    } 
] 
}); 

,您可以关闭它像这样

myPopup.close(); 
+0

谢谢回复@ashfaq我现在已经添加图像。请再次检查 –

+0

以上答案应该帮助你如何关闭弹出窗口。如果您想获得进一步的帮助,请发布弹出窗口的代码。 –

+0

当我使用ng-click来排列优惠券锚标签时,它不会调用方法。但是,当我使用href并给出页面路径时,它会将我重定向到另一个屏幕,但弹出窗口不会隐藏。请帮忙 –