我正在使用angular-ui打開和關閉模式。當我用submit(object)
或dismiss(message)
關閉它時,對話框關閉,但屏幕保持灰色,我無法訪問我的應用程序。一些代碼:
父控制器(相關部分):
$scope.deleteConfirm = function(toDelete) {
console.log(toDelete);
var modalObj = {
templateUrl: 'views/templates/delete.html',
controller: 'DeleteCtrl',
size: 'sm',
resolve: {
toDelete: function() {
return toDelete;
},
collection: function() {
return $scope.users;
}
}
}
var modalInstance = $modal.open(modalObj);
modalInstance.result.then(function (deletedItem) {
console.log(deletedItem);
});
};
父HTML:
<button class="btn btn-danger btn-xs" ng-click="deleteConfirm(user)">X</button>
模態控制器:
.controller('DeleteCtrl', ['$scope', '$modalInstance', 'toDelete', 'collection', function ($scope, $modalInstance, toDelete, collection) {
$scope.toDelete = toDelete;
$scope.remove = function() {
collection.$remove(toDelete).then(function(ref) {
$modalInstance.close(ref);
});
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
}]);
模態模板:
<div class = "ll-modal">
<div class="modal-header">
<h3 class="modal-title">Confirm Delete</h3>
</div>
<div class="modal-body">
Are you sure you want to delete this item? It will be gone forever.
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="remove()">Delete Permanently</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
什麼版本的角和bootstrap?你還在用ngAnmate嗎? – PSL
Angular 1.4,angular-bootstrap 0.12,我現在已經將ngAnimate轉換爲false,如您所建議的 – compguy24
Cool ...或者回退到1.3.x – PSL