Ganesh Yadav
Ganesh Yadav

Reputation: 2685

Ionic on click confirm popup button open another pop up

In my ionic framework on click of submit button a confirmation popup opens.

I want on click of Yes It is! button show another similar popup. How can I target another pop up on click of one popup button.

Find Codepen Demo

my controller code below:

.controller('PopupCtrl', function($scope, $ionicPopup){
    //confirm Number
    $scope.confirmNumber = function(){
        var confirmPopup = $ionicPopup.confirm({
            title: 'NUMBER CONFIRMATION:',
            template: '<span class="numberConfirm">+91 9820098200</span>Is your phone number above correct?',
            buttons: [{ 
              text: 'Edit',
              type: 'button-block button-outline button-stable',
              scope: null,
              onTap: function(e) {

              }

            }, {
              text: 'Yes, it is!',
              type: 'button-block button-outline button-stable',
              onTap: function(e) {

                return scope.data.response;
              }
            }]
        });
        confirmPopup.then(function(res){
            if(res){

            }else{

            }
        });
    };
});

Upvotes: 0

Views: 5306

Answers (1)

Ganesh Yadav
Ganesh Yadav

Reputation: 2685

I finally got solution:

codePen Demo

angular.module('mySuperApp', ['ionic'])

.controller('PopupCtrl', function($scope, $ionicPopup){
    //confirm Number
    $scope.confirmNumber = function(){
        var confirmPopup = $ionicPopup.confirm({
            title: 'NUMBER CONFIRMATION:',
            template: '<span class="numberConfirm">+91 9820098200</span>Is your phone number above correct?',
            buttons: [{ 
              text: 'Edit',
              type: 'button-block button-outline button-stable',
              scope: null,
              onTap: function(e) {

              }

            }, {
              text: 'Yes, it is!',
              type: 'button-block button-outline button-stable',
              onTap: function(e) {
                  $scope.showAlert();
              }
            }]
        });
        confirmPopup.then(function(res){
            if(res){

            }else{

            }
        });
    };

  // permissions 
    $scope.showAlert = function() {
        var alertPopup = $ionicPopup.alert({
            title: 'we would like yo access',
            template: '<i class="ion-android-contacts"></i> Contact <br/> <i class="ion-android-locate"></i> Location',
            okType: 'button-block button-outline button-stable',

        });
        alertPopup.then(function(res) {
            console.log(45);
        });
    };

});

Upvotes: 2

Related Questions