12

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?

2
  • To add some background.. Angular UI Bootstrap simply isn't designed to be used with Bootstrap 4 (click). Support is being actively worked on in the NG2 version of the module (click). Commented Mar 9, 2017 at 8:53
  • @Ankh thanks, I've seen that. But some people on that thread say it's possible. Commented Mar 9, 2017 at 8:54

2 Answers 2

38

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

Sign up to request clarification or add additional context in comments.

1 Comment

I know I should avoid this, but thank you very much!
1

I got solution by using below css

.modal.fade.in {
   opacity: 1;
}
.modal.fade .modal-dialog {
   transform: translate(0, 0) !important;
}

.modal-backdrop.fade {
  opacity: 0.5 !important;
 }
.modal-header{
   display: block;
}
.modal-content{
   border-radius: 1.3rem !important;
}

/* Modal CSS Fix for Bootstrap 4*/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.