Ionic: How is it possible to change the width of $ionicPopup?

孤街醉人 提交于 2019-12-13 07:01:59

问题


I'm trying to change the width of $ionicPopup; I've tried using the following css code, to import it onto cssClass: my-popup:

.my-popup {
      width: 400;
      }

But that didn't seem to work.

I've really got stuck there, and currently unable to find a solution.

Any help will be much appreciated. Thank you.


回答1:


Place the following in the src/theme/variables.scss file;

$popover-ios-width: 300px;



回答2:


It's actually quite straight forward, see the following example:

var pinPopup = $ionicPopup.show({
    templateUrl : 'app/user-profile/user-pin.html',
    title: '4-digit Security PIN',
    scope : $scope,
    cssClass: 'my-popup',
    buttons : [
        {
            text : 'Cancel',
        },
        {
            text : '<b>Save</b>',
            type: 'button-positive',
            onTap : function(e) {
                var val = document.getElementById('pin-output').value;
                $scope.userRow.password = val;
            }
        }
    ]
})

Now in your CSS simply do:

.my-popup .popup {
  width: 400px;
}


来源:https://stackoverflow.com/questions/37482232/ionic-how-is-it-possible-to-change-the-width-of-ionicpopup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!