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

时间:2016-01-26 08:28:48

标签: javascript angularjs angular-ui

如何在打开angularUi Modal后设置选项?

我用

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

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

$modalInstance.close();

但是,当某些事情发生后,我怎样才能为模态设置选项?

backdrop: 'static',
keyboard: false

1 个答案:

答案 0 :(得分:0)

你可以这样使用。
Html代码

<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');
                        };
                    }

                })
            }