Angular Bootstrap Modal leaves backdrop open

后端 未结 6 1441
你的背包
你的背包 2020-12-09 16:04

I\'m using AngularUI to integrate Bootstrap components in my Angular 1.4 app, such as Modals.

I\'m calling a Modal in my controller like so:

var mod         


        
6条回答
  •  鱼传尺愫
    2020-12-09 16:37

    Until the team gets this sorted here is a work around.

    
    
    /*global angular */
    (function () {
    'use strict';
    angular.module('CorvetteClub.removemodal.directive', [])
    .directive('removeModal', ['$document', function ($document) {
        return {
            restrict: 'A',
            link: function (scope, element, attrs) {
                element.bind('click', function () {
                    $document[0].body.classList.remove('modal-open');
                        angular.element($document[0].getElementsByClassName('modal-backdrop')).remove();
                        angular.element($document[0].getElementsByClassName('modal')).remove();
                    });
                }
            };
        }]);
    }());
    

    Unfortunately it appears that the team is not on the same page concerning this issue as it was pushed to a separate thread by a contributor and then the thread it was pushed to was closed by another as it was considered "off topic" by another.

提交回复
热议问题