在角度模态打开后设置选项

Set options after angular modal opened

本文关键字:设置 选项 模态      更新时间:2023-09-26
打开

angularUi 模态后,如何在它上面设置选项?

我创建我的模态

var popup = $modal.open({
    templateUrl: 'parts/payments/views/ConfirmPayoutModal.html',
    controller: 'PayoutCtrl',
    windowClass: 'payout-modal',
});

例如,我可以通过$modalInstance在我的"PayoutCtrl"中访问它

$modalInstance.close();

但是,当发生某些事情时,在打开模态后,我如何为模态设置选项?

backdrop: 'static',
keyboard: false

你可以这样使用。
网页代码

<div class="modal-header">
        <button type="button" ng-hide="ispromiseprogress==true" class="close" ng-click="cancel()" aria-hidden="true"><i class="glyphicon glyphicon-remove"
                                                                                      style="color:black"></i></button>
        <h4 class="modal-title">Login</h4>
</div>
$scope.ispromiseprogress=false;
     $scope.open = function () {
                modalInstance = $modal.open({
                    templateUrl: 'login.html',
                    windowClass: 'app-modal-window',
                    backdrop: false,
                    keyboard: false,
                    modalFade: true,
                    scope: $scope,
                    controller: function ($scope, $modalInstance, $http) {
                        $scope.getData=function(){
$scope.ispromiseprogress=true;
 $http.get(myurl)
            .success(function(data){
$scope.ispromiseprogress=false;
                $scope.login={};
                $scope.login.status=false;
            })
            .error(function(data){
$scope.ispromiseprogress=false;
                window.location="/logout"
            })
}
                        $scope.cancel = function () {
                            $modalInstance.dismiss('cancel');
                        };
                    }
                })
            }