What's wrong with ngAnimate and ui.bootstrap modal?
Asked Answered
I

2

10

In this example

http://plnkr.co/edit/ETwexjK0HRu3b8WovoJq

angular.module('animateApp', [
  'ngAnimate', // adding this causes issue with modal backdrop
  'ui.bootstrap'
])

When you close modal, the backdrop won't go away. If I comment out the 'ngAnimate' dependency (script.js line 4), it works just fine.

Am I doing something wrong or is this a bug in ui.bootstrap when used with ngAnimate?

Intendment answered 3/6, 2015 at 2:16 Comment(0)
W
12

It appears to be a breaking change somewhere between Angular 1.3.15 and 1.4.0. Apparently something in ngAnimate changed that interferes with the backdrop hiding. If you turn off the animation, the backdrop hides fine:

$scope.openModal = function() {
    $modal.open({
      templateUrl: 'modal.html',
      controller: 'ModalCtrl',
      backdrop: true,
      animation: false
    });
  }

If you drop down to 1.3.15, there is no issue: Plunker

If you check the dependencies page for ui-bootstrap, it doesn't look they have quite caught up to 1.4.0 yet: https://david-dm.org/angular-ui/bootstrap#info=devDependencies

It may be worth posting an issue or seeing if someone has already.

Wolk answered 3/6, 2015 at 4:7 Comment(1)
Thanks, here is the reference to the bug reports github.com/angular-ui/bootstrap/issues/3633 and github.com/angular-ui/bootstrap/issues/3620Intendment
R
0

Since, this seems to be a temporary problem, you can config the modal animations to be false.

app.config(['$modalProvider', function($modalProvider)  {
  $modalProvider.options.animation = false;
}

That way you'll have to make this change once and all the modals would work fine.

Resee answered 20/7, 2015 at 7:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.