0

so far to cutomize modal width i have done this

     var modalInstance = $modal.open({
        animation: $scope.animationsEnabled,
        templateUrl: 'AddProtocolElement',
        controller: 'ProtocolElementDialogController',
        backdrop: 'static',
        size: 'lg',
        resolve: {
            items: function () {
                return $scope.items;
            }
        }
    });

and override its modals lg attribute as

    .modal-lg{
    width:1100px !important
    }

it is fine but now what I needed is to have multiple customized lg sized modals on same screen. Here is HTMl

    <script type="text/ng-template" id="AddProtocolElement">
                        <form name="elementForm" id="elementForm" action="#" novalidate class="form-horizontal" role="form">
                            <div class="modal-header ">
                                <h3 class="modal-title">{{formHeading}} Protocol Element</h3>
                            </div>
                            <div class="modal-body">

                            <!-- here goes the body -->
                            </div>



                            <div class="modal-footer ">
                                <!-- here goes the footer -->        

                            </div>

                        </form>

1
  • There should never be more than one modal on the screen at one time, it breaks basic UI assumptions. Commented Dec 14, 2015 at 15:23

2 Answers 2

1

To adjust modal with add to your css:

.adjustwidth .modal-dialog{
   width: 5000px; 
  }

Then add the class to the property windowClass where you instance the modal

var modalInstance = $modal.open({
    animation: $scope.animationsEnabled,
    templateUrl: 'AddProtocolElement',
    controller: 'ProtocolElementDialogController',
    backdrop: 'static',
    windowClass: 'adjustwidth',
    size: 'lg',
    resolve: {
        items: function () {
            return $scope.items;
        }
    }
});
Sign up to request clarification or add additional context in comments.

1 Comment

thanks alot it is really helpful although I managed it through something else but it is really nice. Thanks
0

try width = 150px in JavaScript. This should work without jQuery.

3 Comments

Not sure if this is the best solution.
Please include an example of how you'll actually do this in JavaScript. Give at least a complete statement and not just a suggestion. The questioner seems to have trouble understanding the syntax (IMO).
150px is supposed to be a string. 150px without quotes is not a valid number

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.