ionic framework - How to connect a button in an $ionicPopup to the controller that is invoking it? -


i know ideally using actionsheet solve problem here, want know if possible connect button in ionicpopup controller invoking via ng-click directive. thought ng-click directive introduce $scope of controller, doesn't seem case. mean cannot connect buttons controller in ionicpopup?

$ionicpopup returns promises.

let's view has button invokes (ng-click) method in controller:

<button class="button button-primary" ng-click="showconfirm()">confirm</button> 

in controller invoke popup doing this:

$scope.showconfirm = function() {    var confirmpopup = $ionicpopup.confirm({      title: 'consume ice cream',      template: 'are sure want eat ice cream?'    });    confirmpopup.then(function(res) {      if(res) {        console.log('you sure');      } else {        console.log('you not sure');      }    });  }; 

when user has tapped on 1 of 2 buttons in confirm dialog can read result , other things.

confirmpopup.then(function(res) {      if(res) {        console.log('you sure');      } else {        console.log('you not sure');      }    }); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -