答案 0 :(得分:0)
您需要http://plnkr.co/edit/LYOEntdgLbONNAzH0Ove?p=preview
之类的内容吗?为每个值定义模态模板 - modal1,modal2,..
<script type="text/ng-template" id="modal1.html">
<div class="modal-header">
<h3 class="modal-title">modal1 - {{ action }}</h3>
</div>
<div class="modal-body">
modal1
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="button" ng-click="ok()">OK</button>
<button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
</div>
</script>
和这个功能
$scope.showModal = function(action) {
if (!$scope.modes.mode) return
$scope.action = action
$scope.modal = $uibModal.open({
templateUrl: $scope.modes.mode+'.html',
scope: $scope
});
}
您可以通过按钮ng-click
处理程序调用showModal(操作只是为了演示模板/按钮关系)
$scope.delete = function() {
$scope.showModal('delete')
}
...