Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Callback "$animate:close" isn't called after an ng-leave animation finishes #6049

Closed
ravishivt opened this issue Jan 29, 2014 · 12 comments
Closed

Comments

@ravishivt
Copy link

The $animate:after and $animate:close callbacks fire for ng-enter events but they do not fire for ng-leave events. Is this expected since the element/directive doesn't exist anymore? Is there a workaround besides using JS animations?

Example at http://jsbin.com/utOrAPO/11/edit?html,js,output

@matsko matsko self-assigned this Feb 28, 2014
@matsko
Copy link
Contributor

matsko commented Mar 18, 2014

The better workaround would be to always issue animation callbacks on the parent element. Or to just further push out the leave DOM operation. I think the ladder is a good solution for 1.2.x.

@btford btford added this to the Backlog milestone Mar 27, 2014
@mdudek
Copy link

mdudek commented Apr 9, 2014

Some progress regarding this issue?

@matsko
Copy link
Contributor

matsko commented Apr 10, 2014

Not yet. For consistency I think the parent element fix is the way to go. I'll just need to talk with @IgorMinar to see if this is OK for 1.3.

@btford btford removed the gh: issue label Aug 20, 2014
@wnr
Copy link

wnr commented Sep 25, 2014

Hello, I'm having the same issue here and I cannot figure out how to do the parent workaround as you described "The better workaround would be to always issue animation callbacks on the parent element.". Could you please provide an example? If you could edit the jsbin provided above to make it work with the parent fix, I would be really grateful :)

Thanks

@tristanguigue
Copy link

Any progress on this? I don't see any workaround to detect completion of ng-leave when using CSS animations.

@matsko
Copy link
Contributor

matsko commented Nov 30, 2014

Sorry for the delay. Once #10067 is complete then I will hop over to this one. That issue requires a rather large refactoring and it needs to be figured out prior to this one.

@urpro-bas
Copy link

This issue still seems to exist in 1.4, is that correct? Any estimation on when it's done or any workaround?

@urpro-bas
Copy link

I have made a work around, it's kind of a dirty hack, but it works for me maybe it also works for others. The problem is caused by the parent no longer being available when the leave animation is finished (it's removed from the dom). My hack adds the option to listen to "*" instead of a dom element. So $animate.on('leave', '*', function(element, phase){ })

My code can be found here: https://github.com/urpro-bas/bower-angular-animate

@johngrogg
Copy link

Just encountered this issue today. An update on the status of a solution would be great.

@chucksellick
Copy link

Just ran into this. Really confusing behaviour. At the very least it should be mentioned in the $animate documentation if this phase will never fire for the "leave" event. Trying to write a scrollbar that will automatically update its handle after any transitions finish and now I need a dirty workaround!

@Narretz
Copy link
Contributor

Narretz commented Jan 22, 2016

AS far as I can see, this works in 1.4: http://plnkr.co/edit/092B9gDPtqcJQ7q9WXXG?p=preview The event syntax has changed, though.

@Narretz Narretz closed this as completed Jan 22, 2016
@ahagelstein
Copy link

If I try out your sample with version 1.5.2 (I only changed the script tags on index.html) then I missed the leave close event. Any ideas??

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