在 select 下拉列表中打开基于条件的模态对话框

Open modal dialog based condition in select drop down

我在单击这样的按钮时会打开一个模式对话框:

<button type="button" data-toggle="modal" data-target="#openModal">Click</button>

<div class="modal fade" id="openModal"
         tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
//modal body
</div>

我想知道有没有什么方法可以打开基于select下拉框的模态对话框?特别是使用javascript/angular js

我没有完全理解问题。但是,你需要像 this plunker 这样的东西吗?

<script type="text/ng-template" id="modal1.html">
    <div class="modal-header">
        <h3 class="modal-title">Modal 1</h3>
    </div>
</script>
<script type="text/ng-template" id="modal2.html">
    <div class="modal-header">
        <h3 class="modal-title">Modal 2</h3>
    </div>
</script>

Select number of modal you'd like to open:
<select ng-model="form.selection">
  <option value="modal1">Modal 1</option>
  <option value="modal2">Modal 2</option>
</select>

<button class="btn btn-default" ng-click="open()">Open me!</button>

$scope.form = {
  selection: "modal1"
};

$scope.open = function (size) {

  var modalInstance = $modal.open({
    templateUrl: $scope.form.selection + '.html',
    controller: 'ModalInstanceCtrl'
  });
};