![](/img/trans.png)
[英]How to set focus on the elements of the modal as soon as they are opened in Angular 2?
[英]Set options after angular modal opened
打開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
您可以這樣使用。
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');
};
}
})
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.