Software Archive
Read-only legacy content
17060 Discussions

Call IONIC PopUp from javascript function

David_G_4
Novice
255 Views

I am using an Ionic popup and I want to open it using only javascript.

I was able to open it using button:

 <button  ng-controller="uib_w_69_popup_controller" ng-click="show()" class="button widget uib_w_28 d-margins "  data-uib="ionic/button" data-ver="0" id="site-1">Button Name</button>

Now how do I open it using only javascript?

Here is the js for the popup:

function uib_w_69_popup_controller($scope, $ionicPopup) {

  // A confirm dialog

  $scope.show = function() {
    var confirmPopup = $ionicPopup.confirm({
      title: 'Consume Ice Cream',
      template: 'Are you sure you want to eat this ice cream?'
    });
    confirmPopup.then(function(res) {
      if(res) {
        console.log('You are sure');
      } else {
        console.log('You are not sure');
      }
    });
  };

};

Thanks for your help

0 Kudos
0 Replies
Reply