问题
Good day! I'm making a page and I'm using a bs switch. When I switch it on, the modal that is supposed to pop up is already showing. My problem now is that when I switch it off, a different modal should also pop up. I have tried several codes but its not working. Thanks for any help.
This is my html code for the switch:
<div class="switch_button">
<input type="checkbox" ng-model="checkbox[$modalArray]" ng-change="modalVolEn($modalArray)" bs-switch />
</div>
my controller is :
$scope.modalArray = [];
$scope.modalVolEn = function() {
if($scope.modalArray) {
$('#showModal').modal('show');
}
else{
$('#showModal2').modal('show');
}
};
and my modals:
<div class="modal fade" id="showModal" data-keyboard="false" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
---------
<div class="modal fade" id="showModal2" data-keyboard="false" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
来源:https://stackoverflow.com/questions/35691225/modal-on-bs-switch-angularjs