모달을 만들고 있습니다.
var modal = $modal.open({
                    templateUrl: "/partials/welcome",
                    controller: "welcomeCtrl",
                    backdrop: "static",
                    scope: $scope,
                });
너비를 늘리는 방법이 있습니까?
답변
모달 대화 상자 클래스를 대상으로하는 CSS 클래스를 사용합니다.
.app-modal-window .modal-dialog {
  width: 500px;
}
그런 다음 모달 창을 호출하는 컨트롤러에서 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;
            });
    };
답변
또 다른 쉬운 방법은 미리 만들어진 2 개의 크기를 사용하고 html에서 함수를 호출 할 때 매개 변수로 전달하는 것입니다. use : 너비가 900px 인 큰 모달의 경우 ‘lg’너비가 300px 인 작은 모달의 경우 ‘sm’이거나 매개 변수를 전달하지 않으면 기본 크기 인 600px를 사용합니다.
예제 코드 :
$scope.openModal = function (size) {
var modal = $modal.open({
                templateUrl: "/partials/welcome",
                controller: "welcomeCtrl",
                backdrop: "static",
                scope: $scope,
                size: size,
            });
modal.result.then(
        //close
        function (result) {
            var a = result;
        },
        //dismiss
        function (result) {
            var a = result;
        });
};
그리고 html에서 다음과 같은 것을 사용합니다.
<button ng-click="openModal('lg')">open Modal</button>  
답변
더 넓은 뷰포트 해상도를 위해 팝업에 대해 .modal-lg 클래스에 대한 사용자 정의 너비를 지정할 수 있습니다. 방법은 다음과 같습니다.
CSS :
@media (min-width: 1400px){
   .my-modal-popup .modal-lg {
       width: 1308px;
   }
}
JS :
var modal = $modal.open({
    animation: true,
    templateUrl: 'modalTemplate.html',
    controller: 'modalController',
    size: 'lg',
    windowClass: 'my-modal-popup'
});
답변
모달을 열면 크기를 매개 변수로 받아들입니다.
크기에 가능한 값 : sm, md, lg
$scope.openModal = function (size) {
var modal = $modal.open({
      size: size,
      templateUrl: "/app/user/welcome.html",
      ......
      });
}
HTML :
<button type="button"
    class="btn btn-default"
    ng-click="openModal('sm')">Small Modal</button>
<button type="button"
    class="btn btn-default"
    ng-click="openModal('md')">Medium Modal</button>
<button type="button"
    class="btn btn-default"
    ng-click="openModal('lg')">Large Modal</button>
특정 크기를 원하면 모델 HTML에 스타일을 추가하십시오.
<style>.modal-dialog {width: 500px;} </style>
답변
uibModal 클래스를 덮어 쓰지 않고 필요한 경우 사용하지 않아도되는 또 다른 방법이 있습니다. “xlg”와 같은 고유 한 크기 유형으로 $ uibModal.open 함수를 호출 한 다음 아래와 같이 “modal-xlg”라는 클래스를 정의합니다. :
.modal-xlg{
   width:1200px;
}
$ uibModal.open을 다음과 같이 호출하십시오.
 var modalInstance = $uibModal.open({
                ...
                size: "xlg",
            });
그리고 이것은 작동합니다. 어떤 문자열을 사이즈 부트 스트랩으로 전달하든 “modal-“과 cocant 할 것이고 이것은 window의 클래스 역할을 할 것이기 때문입니다.
답변
Bootstrap-ui에서 템플릿을 가져 오는 것이 더 쉽다는 것을 알았습니다. 내가 변경 한 내용을 보여주기 위해 주석이 달린 HTML을 그대로 두었습니다.
기본 템플릿을 덮어 씁니다.
<script type="text/ng-template" id="myDlgTemplateWrapper.html">
    <div tabindex="-1" role="dialog" class="modal fade" ng-class="{in: animate}"
         ng-style="{'z-index': 1050 + index*10, display: 'block'}" ng-click="close($event)">
        <!-- <div class="modal-dialog"
            ng-class="{'modal-sm': size == 'sm', 'modal-lg': size == 'lg'}"
            >
            <div class="modal-content"  modal-transclude></div>
        </div>-->
        <div modal-transclude>
            <!-- Your content goes here -->
        </div>
    </div>
</script>
대화 템플릿을 수정합니다 ( “modal-dialog”클래스와 “modal-content”클래스를 포함하는 래퍼 DIV에 유의하십시오) :
<script type="text/ng-template" id="myModalContent.html">
    <div class="modal-dialog {{extraDlgClass}}"
         style="width: {{width}}; max-width: {{maxWidth}}; min-width: {{minWidth}}; ">
        <div class="modal-content">
            <div class="modal-header bg-primary">
                <h3>I am a more flexible modal!</h3>
            </div>
            <div class="modal-body"
                 style="min-height: {{minHeight}}; height: {{height}}; max-height {{maxHeight}}; ">
                <p>Make me any size you want</p>
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" ng-click="ok()">OK</button>
                <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
            </div>
        </div>
    </div>
</script>
그런 다음 변경하려는 CSS 클래스 또는 스타일 매개 변수를 사용하여 모달을 호출합니다 (이미 다른 곳에 “app”을 정의했다고 가정).
<script type="text/javascript">
    app.controller("myTest", ["$scope", "$modal", function ($scope, $modal)
    {
        //  Adjust these with your parameters as needed
        $scope.extraDlgClass = undefined;
        $scope.width = "70%";
        $scope.height = "200px";
        $scope.maxWidth = undefined;
        $scope.maxHeight = undefined;
        $scope.minWidth = undefined;
        $scope.minHeight = undefined;
        $scope.open = function ()
        {
            $scope.modalInstance = $modal.open(
            {
                backdrop: 'static',
                keyboard: false,
                modalFade: true,
                templateUrl: "myModalContent.html",
                windowTemplateUrl: "myDlgTemplateWrapper.html",
                scope: $scope,
                //size: size,   - overwritten by the extraDlgClass below (use 'modal-lg' or 'modal-sm' if desired)
                extraDlgClass: $scope.extraDlgClass,
                width: $scope.width,
                height: $scope.height,
                maxWidth: $scope.maxWidth,
                maxHeight: $scope.maxHeight,
                minWidth: $scope.minWidth,
                minHeight: $scope.minHeight
            });
            $scope.modalInstance.result.then(function ()
            {
                console.log('Modal closed at: ' + new Date());
            },
            function ()
            {
                console.log('Modal dismissed at: ' + new Date());
            });
        };
        $scope.ok = function ($event)
        {
            if ($event)
                $event.preventDefault();
            $scope.modalInstance.close("OK");
        };
        $scope.cancel = function ($event)
        {
            if ($event)
                $event.preventDefault();
            $scope.modalInstance.dismiss('cancel');
        };
        $scope.openFlexModal = function ()
        {
            $scope.open();
        }
    }]);
</script>
“열기”버튼을 추가하고 발사하십시오.
    <button ng-controller="myTest" class="btn btn-default" type="button" ng-click="openFlexModal();">Open Flex Modal!</button>
이제 원하는 추가 클래스를 추가하거나 필요에 따라 너비 / 높이 크기를 변경할 수 있습니다.
나는 그것을 래퍼 지시문 안에 추가로 포함 시켰는데,이 시점부터는 사소해야한다.
건배.
답변
Dmitry Komin 솔루션을 사용하여 문제를 해결했지만 다른 CSS 구문을 사용하여 브라우저에서 직접 작동합니다.
CSS
@media(min-width: 1400px){
    .my-modal > .modal-lg {
        width: 1308px;
    }
}
JS는 동일합니다.
var modal = $modal.open({
    animation: true,
    templateUrl: 'modalTemplate.html',
    controller: 'modalController',
    size: 'lg',
    windowClass: 'my-modal'
});