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

fix(modal): Modal Dialog doesn't fade out #3888

Closed
wants to merge 1 commit into from

Conversation

ihenshaw
Copy link

@ihenshaw ihenshaw commented Jul 2, 2015

This fixed the issue for me. I have tested it with Angular 1.4 and 1.3 and it seems to work for both.

It seems in Angular 1.4, the animation events are no longer triggered on elements, instead there are new functions on $animate for registering / deregistering listeners. It also seems that the "close" event doesn't exist anymore, at least I found no reference to it.

The approach to fixing the issue was to listen for a "removeClass" event. When we get one of those, we check the event phase, it needs to be "close". This seems to be about the point where the old $animate:close event would have been triggered.

Unfortunately, the $animate service does not provide functions for registering one off listeners like element.one, so I've had to manually remove the event listener in the handler.

Finally, when all that was working, I re-introduced the old mechanism for Angular 1.3 support (I assume we'll want to support both).

This fixes #3633

Hopefully that'll sort it!

@chrisirhc
Copy link
Contributor

Thanks! This will indeed fix it. Your PR helped me with understanding this problem better. I now understand that the modal needs a bit of refactoring to support 1.4 .

The reason I'm not accepting this is that silently break users of the custom template because of the dependency on the removeClass animation event. I'll refactor the template to pass in the in class to the controller so the controller can make use of the $animate service (like $animate.addClass(inClass).then(removeModal) and avoid the need for listening to event of the end of the animation.

I intend to close this only when I've submitted that refactoring PR.

@chrisirhc chrisirhc added this to the Purgatory milestone Jul 4, 2015
@chrisirhc chrisirhc self-assigned this Jul 4, 2015
chrisirhc added a commit to chrisirhc/angular-ui-bootstrap that referenced this pull request Jul 4, 2015
chrisirhc added a commit to chrisirhc/angular-ui-bootstrap that referenced this pull request Jul 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modal Dialog doesn't fade out
2 participants