2015-06-05 41 views
1

我上點擊按鈕打開一個模式對話框是這樣的:打開模態對話框基礎條件下

<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> 

我想知道是否有與一個可以打開任何方法一個基於模式對話框的選擇下拉??特殊使用javascript/angular js

回答

1

我沒有完全理解這個問題。但是,你需要像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' 
    }); 
}; 
+0

需要在通過添加NG-變化解決一個按鈕 – forgottofly

+0

的點擊選擇降down.Not的變化打開模態= 「打開()」 中