html 在AngularJS中使用Modal

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 在AngularJS中使用Modal相关的知识,希望对你有一定的参考价值。

// open modal
var modalInstance = $uibModal.open({
    templateUrl: 'assets/meeting/modal/end-meeting.modal.html',
    controller: modelInstanceController
});

// do something after modal
modalInstance.result.then(function(param) {
    // do something here
})

modelInstanceController.$inject = ['$scope', '$state'];
function modelInstanceController($scope, $state) {
    
    $scope.ok = ok;
    $scope.cancel = close;

    function close() {
        // close without sending parameter
        modalInstance.close();
        
        // close with sending param
        modalInstance.close(param);
    }

    function ok() {
      // do something
    }
}
<div class="modal-header modal-primary" ng-click="out()">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close" ng-click="cancel()">
        <span aria-hidden="true">&times;</span>
    </button>
    <h4 class="modal-title">Do Something</h4>
</div>
<div class="modal-body">
    <div class="form-group text-center">
        <label class="control-label">Are you sure to do something?</label>
    </div>

	<div class="form-group pull-right">
	    <button class="btn btn-primary" type="button">Confirm</button>
	    <button class="btn btn-default" type="button">Cancel</button>
	</div>
	<div class="clearfix"></div>
</div>

以上是关于html 在AngularJS中使用Modal的主要内容,如果未能解决你的问题,请参考以下文章

Jquery Modal弹出窗口中的Angularjs Scope

在 AngularJS 单元测试中模拟 $modal

angularjs 弹出框 $modal 参数(转)

angularjs 弹出框 $modal

AngularJs 在 Modal 中清除表单并将其设置为 ng-invalid

系统关闭后仍在调用$modal控制器的作用域函数。