How can i add attribute to $ionicPopup?


#1

i am plan to add attribute to $ionicPopup.
how can i add it?

(ionicPopup.alert / ionicPopup.show etc.)


#2

Hi amyHi,

For adding $ionicpopup first you need to add $ionicPopup this in your .controller function. Like mentioned below

.controller('PopupCtrl',function($scope, $ionicPopup, $timeout) {
   var alertPopup = $ionicPopup.alert({
     title: 'Success',
     template: 'This is an alert message'
   });

   alertPopup.then(function(res) {
     // Place your code for performing something after closing alert popup.
   });

  // Custom popup
  var showPopup = $ionicPopup.show({
    template: YOU CAN PLACE YOUR INPUT TAGS,
    title: 'Title',
    subTitle: 'SUB TITLE IF YOU WANT',
    scope: $scope,
    buttons: [
      { text: 'Cancel' },
      {
        text: 'Save'
      }
    ]
  });

  showPopup.then(function(res) {
    // Place your code for performing something after closing alert popup.
  });
})

Hope this will help you understand the things you want.


#3

thank you for replying.
however, i want to set ‘data-tap-disabled=true’ on ionicPopup Button.


#4

Hi amyHi,

For adding data-tap-disabled=true to your save button in popup you can write below mentioned code.

.controller('PopupCtrl',function($scope, $ionicPopup, $timeout) {
  
  // Custom popup
  var showPopup = $ionicPopup.show({
    template: YOU CAN PLACE YOUR INPUT TAGS,
    title: 'Title',
    subTitle: 'SUB TITLE IF YOU WANT',
    scope: $scope,
    buttons: [
      { text: 'Cancel' },
      {
        text: '<span data-tap-disabled="true">Save</span>'
      }
    ]
  });

  showPopup.then(function(res) {
    // Place your code for performing something after closing alert popup.
  });
})

This will add the attribute you want on save button.