ionic framework - ionicPopup doesnt close only hides. -


in code, when trigger ionicpopup, upon button tap, triggers ionicpopup should close previous ionicpopup. however, in implementation, while close final ionicpopup, initial ionicpopup doesnt close rather hides causes app freeze. there way make sure ionicpopups closed or @ least close each ionicpopup upon button tap. codepen of code http://codepen.io/anon/pen/dyvdjv

 $scope.showpopup = function() {    $scope.data = {}      $ionicpopup.show({       title: ' session terminated!',       scope: $scope,       template:' logged device/browser. pls log out other device/browser!',       buttons: [         { text: '<h6 style="text-transform: capitalize;">cancel</h6>',           type: 'button-positive'         },         {             text: '<h6 style="text-transform: capitalize;">verify me</h6>',           type: 'button-positive',           ontap: function(e) {             $scope.verifyme();           }         }       ]       }).then(function(res) {       console.log('tapped!', res);     }, function(err) {       console.log('err:', err);     }, function(popup) {       console.log('got popup', popup);       $timeout(function() {         popup.close();       }, 1000);     });   };     $scope.verifyme = function() {     $ionicpopup.show({       title: ' enter username',       scope: $scope,       template:'<input type="text" ng-model="user.username">',       buttons: [         {             text: '<h5 style="text-transform: capitalize;">verify me</h5>',           type: 'button-positive',           ontap: function(e) {             $scope.verifynow('first.app');           }         }       ]       }).then(function(res) {       console.log('tapped!', res);     }, function(err) {       console.log('err:', err);     }, function(popup) {       console.log('got popup', popup);       $timeout(function() {         popup.close();       }, 1000);     });   };    $scope.verifynow = function(username)   {     console.log("verified , removed" + username)   } 

once execution of code complete, when check code

<div class="popup-container popup-showing popup-hidden" ng-class="cssclass">   //more code here </div> 

this popup opened in first ionicpopup.show({}), second ionicpopup.show({}) gets closed. dont know why first 1 gets hidden instead of closed.

here working example. used example given in ionic docs along code:

    var mypopup = $ionicpopup.show({       title: ' enter username',       scope: $scope,       template: '<input type="text" ng-model="user.username">',       buttons: [{         text: '<h5 style="text-transform: capitalize;">verify me</h5>',         type: 'button-positive',         ontap: function(e) {             mypopup.close();           return console.log("verified , removed");         }       }]     });    };   // confirm dialog   $scope.showconfirm = function() {     var confirmpopup = $ionicpopup.confirm({       title: ' session terminated!',       scope: $scope,       template: ' logged device/browser. pls log out other device/browser!',       buttons: [{         text: '<h6 style="text-transform: capitalize;">cancel</h6>',         type: 'button-positive'       }, {         text: '<h6 style="text-transform: capitalize;">verify me</h6>',         type: 'button-positive',         ontap: function(e) {           confirmpopup.close();            $timeout(function() {             $scope.showpopup();           });          }       }]     });     confirmpopup.then(function(res) {       if (res) {         console.log('you sure');       } else {         console.log('you not sure');       }     });   };    // 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 not eating delicious ice cream cone');     });   }; 

notice

 $timeout(function() {             //code           }); 

that waiting confirmpopup.close(); , executes inside (in our case opening new popup).


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -