sabbir
sabbir

Reputation: 2025

ionic popup close not working

I have created an ionic app where a popup window is opened to ask user to rate this app if he did not rate this app previously. Ionic popup appear correctly, but my problem is, user have to click/tap on cancel button twice to close popup and sometimes click/tap is not working.

My code is given below:

 (function() {

      $scope.data = {}

      var myPopup = $ionicPopup.show({
        template: '<input type="range" ng-model="data.user_ratting">',
        title: 'Do you want to rate this app?',
        scope: $scope,
        buttons: [
          { text: 'Cancel' },
          {
            text: '<b>Save</b>',
            type: 'button-positive',
            onTap: function(e) {

             }
          }
       ]
  });

    myPopup.then(function(res) {
      console.log('Tapped!', res);
    });

 })();

How can I solve this problem??

Upvotes: 0

Views: 10579

Answers (2)

Anil kumar
Anil kumar

Reputation: 928

can you try this one

var popup = $ionicPopup.show({
    title: 'Enter Wi-Fi Password',
    subTitle: 'Please use normal things',
    scope: $scope,
    buttons: [
              { text: 'ready',  onTap: function(e) {
                  console.log(e);
                  return true; 
                } 
           }
             ]
  }).then(function(result){
    console.log('Tapped', result);
  }, function(error){
    console.log('error', error);
  }, function(popup){
    popup.close();
  })

Upvotes: 2

R&#233;mi P
R&#233;mi P

Reputation: 440

Please have a look at the codepen I Did for you :

http://codepen.io/privetr/pen/QjjyMB

$scope.openPopup = function() {
  var myPopup = $ionicPopup.show({
    template: '<input type="range" ng-model="data.user_ratting">',
    title: 'Do you want to rate this app?',
    scope: $scope,
    buttons: [
      { text: 'Cancel' },
      {
        text: '<b>Save</b>',
        type: 'button-positive',
        onTap: function(e) {

         }
      }
   ]
});

myPopup.then(function(res) {
  console.log('Tapped!', res);
});
}

// To automatically open the popup
$scope.openPopup();

this code works, I just added a function to call the Popup when the top right button is clicked.

I hope it will solves your problem !

Upvotes: 1

Related Questions