Search code examples
angularjstwitter-bootstrapangular-uitwitter-bootstrap-4

Angular UI modal with Bootstrap 4


Bootstrap 3 modal works fine: https://jsfiddle.net/qLy7gk3f/4/

But Bootstrap 4 modal doesn't: https://jsfiddle.net/qLy7gk3f/3/

The code is identical:

$scope.click = function() {
  $uibModal.open({
    templateUrl: "modal.html",
    controller: "modal",
    scope: $scope
  });
}

How can I get AngularUI modals to work with Bootstrap 4?


Solution

  • I think it's just a case of adding the .in classes, specifically:

    .fade.in {
        opacity: 1;
    }
    
    .modal.in .modal-dialog {
      -webkit-transform: translate(0, 0);
           -o-transform: translate(0, 0);
              transform: translate(0, 0);
    }
    
    .modal-backdrop.in {
        filter: alpha(opacity=50);
        opacity: .5;
    }
    

    Updated fiddle: https://jsfiddle.net/qLy7gk3f/5/

    Or you could modify Bootstrap 4 to use the show class: https://github.com/angular-ui/bootstrap/issues/4234#issuecomment-285303515