Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Modal - can't close if using angular 1.4 #3620

Closed
alippai opened this issue May 5, 2015 · 20 comments
Closed

Modal - can't close if using angular 1.4 #3620

alippai opened this issue May 5, 2015 · 20 comments

Comments

@alippai
Copy link

alippai commented May 5, 2015

You can't close modals with version 0.13. Angular-bootstrap 0.12 modal works well with angular 1.4.
Angular 1.3 + bootstrap 0.13 works too.

@rvanbaalen
Copy link
Contributor

Plunker please.

@RobJacobs
Copy link
Contributor

There is a known issue with Angular 1.4 and the Modal/Carousel directives. The ngAnimate module had some significant changes documented here that breaks how those directives are chaining animations. The area that needs to be addressed in the modal is here. As a workaround, I changed that line from:

domEl.one('$animate:close', function closeFn() {
    $rootScope.$evalAsync(afterAnimating);
}

To:

$rootScope.$evalAsync(afterAnimating);

You lose the closing animation. @chrisirhc is aware of the problem.

@karianna karianna added this to the Backlog milestone May 5, 2015
@rvanbaalen
Copy link
Contributor

@RobJacobs What you're refering to is probably #3615 ?

@alippai specifically said he 'cant close modals' which would suggest that the modal always stays open after opening once. Thats why I asked for a plunkr reproducing this problem.

Reading this again, the issue is supposedly with AngularJS 1.4, which we don't currently support since it's still in beta.

If you're using UI Bootstrap, use 0.13 with Angular 1.3 and it's all good.

@alippai
Copy link
Author

alippai commented May 5, 2015

Only the backdrop didn't disappear, the dialog closed successfully. I couldn't create a plunker as the official demo worked with angular 1.4.

@rvanbaalen
Copy link
Contributor

When you create a plunkr you can choose which library versions you want to use.

@alippai
Copy link
Author

alippai commented May 5, 2015

I referenced the correct versions, but couldn't reproduce the wrong behaviour.

@rvanbaalen
Copy link
Contributor

That's when an issue gets closed 😉

@RobJacobs
Copy link
Contributor

@alippai is correct, the modal will close, but the backdrop element does not get removed. Reason being the $animate api has changed on how to attach event handlers. It needs to be:

$animate.on(element, 'event', function() {})

So the afterAnimating function never gets called which is responsible from removing the backdrop element. Oddly enough, plunkr does not exhibit this behavior but I've been testing Angular 1.4 compatibility locally with the documentation page and that's how I noticed the problem.

@rvanbaalen
Copy link
Contributor

Reopening. Related: #3624

@alippai
Copy link
Author

alippai commented May 6, 2015

with AngularJS 1.4, which we don't currently support since it's still in beta.
Please note, that your statement above is false. AngularJS 1.4 is out of beta, it's a RC now.

We love to use the fresh version of the 3rd parties, caught this bug testing the upgrade path on an experimental branch. Few weeks from now newbies will download AngularJS 1.4 with Angular Bootstrap 0.13 and it won't work, don't kill their learning process please. I can stick with the old version for months, they can't and won't do that.

@karianna
Copy link
Contributor

karianna commented May 6, 2015

@alippai You're welcome to submit PRs to help out!

@karianna karianna modified the milestones: 0.13.x, Backlog May 6, 2015
@chrisirhc
Copy link
Contributor

This looks like a reasonable support to add, check for the presence of $animate.on and use that instead of element.on('$animate:close'…. Feel free to submit PRs. I believe the same fix can be applied to the Carousel.

@LeleDev
Copy link

LeleDev commented May 7, 2015

angular 1.4 here too, and this is the only critical bug that prevents me from upgrading to 0.13... It would be super cool to have this fixed soon!

@rvanbaalen
Copy link
Contributor

Continuing this discussion in #3633 since it has a more fitting issue title and description, describing exactly what is discussed here.

@Oceanswave
Copy link

+1

@bradyisom
Copy link

Just for the record, this is not just an Angular 1.4 issue. I am using Angular 1.3 and I started getting this issue when I upgraded from 0.12.1 to 0.13.0. Upgrading to the latest version of Angular 1.3 (1.3.16) did not solve my issue. However, it seems to point to the same lines of code as the Angular 1.4 issue (listening for the '$animate:close' event). That event never fires in my case. Globally turning off animation with $animate.enabled(false) makes modal dialogs start to close again.

@fracz
Copy link

fracz commented Jun 14, 2015

Plunker that does not close backdrop (only if app depends on ngAnimate): http://plnkr.co/edit/lQMQm5NJuRHkTBfER7cq?p=preview

@willhartman
Copy link

I had a problem where the modal itself would close, but the modal backdrop would remain.

Downgrading angular.js and angular-animate.js to 1.3.16 resolved this issue for me.

@ldeavila
Copy link

Modal closes but backdrop remains with ui-bootstrap 0.13 and angular 1.4. Can be worked around by setting the animation property to false when calling $modal.open()

@rvanbaalen
Copy link
Contributor

I just go ahead and repeat myself:

Continuing this discussion in #3633 since it has a more fitting issue title and description, describing exactly what is discussed here.

I'll close the comments here and encourage everyone to continue this discussion in #3633 so we can keep everything in one place instead of having to manage duplicate issues.

@angular-ui angular-ui locked and limited conversation to collaborators Jun 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests