2016-02-06 84 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並給出頁面路徑時,它會將我重定向到另一個屏幕,但彈出窗口不會隱藏。請幫忙 –