Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I increase modal width in Angular UI Bootstrap?

I am creating a modal:

var modal = $modal.open({                     templateUrl: "/partials/welcome",                     controller: "welcomeCtrl",                     backdrop: "static",                     scope: $scope,                 }); 

is there a way to increase its width?

like image 663
Ivan Bacher Avatar asked Jan 23 '14 14:01

Ivan Bacher


People also ask

How do I make bootstrap modal wider?

Change the size of the modal by adding the . modal-sm class for small modals, . modal-lg class for large modals, or . modal-xl for extra large modals.

How do you change modal height?

modal-body use calc() function to calculate desired height. In above case we want to occupy 80vh of the viewport, reduced by the size of header + footer in pixels. This is around 140px together but you can measure it easily and apply your own custom values. For smaller/taller modal modify 80vh accordingly.

How do you increase modal size in Reactstrap?

The docs reactstrap really bad to explained. Don't forget everyone, you can also do size="xl" . To achieve greater sizes than this, you have to use a stylesheet imported and on the Modal component itself, specifically a property called contentClassName . By writing to a separate file like styles.

How can I make my modal height responsive?

Making your Modal Responsive The most obvious way is to write a bunch of media queries like a chump. I instead suggest using max-width and max-height. When combined with calc() this allows you to have a consistent padding between the modal and the edge of the screen on smaller devices.


1 Answers

I use a css class like so to target the modal-dialog class:

.app-modal-window .modal-dialog {   width: 500px; } 

Then in the controller calling the modal window, set the windowClass:

    $scope.modalButtonClick = function () {         var modalInstance = $modal.open({             templateUrl: 'App/Views/modalView.html',             controller: 'modalController',             windowClass: 'app-modal-window'         });         modalInstance.result.then(             //close             function (result) {                 var a = result;             },             //dismiss             function (result) {                 var a = result;             });     }; 
like image 72
Rob J Avatar answered Sep 23 '22 16:09

Rob J