Modal on BS Switch AngularJS

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 11:21:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!