有棱角的我以前能做这个
var title = 'title';
var messageBody = 'message';
var buttons = [{ result: 'ok', label: 'OK', cssClass: 'btn-primary' }];
$dialog.messageBox(title, messageBody, buttons).open();但是现在,$dialog已经被$modal取代了。
在新的计划中,与上述措施相等的是甚麽呢?
发布于 2014-07-10 18:03:00
使用$modal:
示例HTML:
<div>
    <div class="modal-header">
        <h3 class="modal-title">{{data.title}}</h3>
    </div>
    <div class="modal-body">
        {{data.message}}
    </div>
    <div class="modal-footer">
        <button class="btn-primary" ng-click="ok()">Ok</button>
    </div>
</div>示例JS:
var MyModalCtrl = function ($scope, $modal) {
    $scope.title = 'I'm a Modal';
    $scope.message = 'Hello World';
    $scope.open = function () {
    var modalInstance = $modal.open({
        templateUrl: '/path/to/html',
        controller: MyModalInstanceCtrl,
        size: 'lg',
        resolve: {
        data: function () {
                return {title: $scope.title, message: $scope.message};
            }
        }
    });
    modalInstance.result.then(function (selectedItem) {
        console.log('Closed');
    });
};
var MyModalInstanceCtrl = function ($scope, $modalInstance, data) {
    $scope.data = data;
    $scope.ok = function () {
        $modalInstance.close();
    };
};这方面的文档可以在这里找到:http://angular-ui.github.io/bootstrap/
https://stackoverflow.com/questions/24681964
复制相似问题