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

Callback $animate.on() leave-close isn't called after an ng-leave animation finishes #14321

Closed
ahagelstein opened this issue Mar 26, 2016 · 1 comment

Comments

@ahagelstein
Copy link

Do you want to request a feature or report a bug?

Report a bug.

What is the current behavior?

Based on #6049 I have modified the sample code to use the current angular version 1.5.3.

http://plnkr.co/edit/KffprsYkzg6ZoTfzsC7y?p=preview

With 1.5.2/1.5.3 the leave-close callback is not called.

If I remove the following lines from angular-animate.js the callback is working:

jqLite(container).on('$destroy', function() {
$animate.off(event, container, callback);
});

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.

1.5.2/1.5.3 --> bug
1.4.9/1.5.0/1.5.1 --> ok

@Narretz
Copy link
Contributor

Narretz commented Mar 28, 2016

Thanks for the report. This was introduced by ce7f400, (the lines you commented out).
We have to make sure that the listeners are removed after the callbacks for "leave" have been fired.

Narretz added a commit to Narretz/angular.js that referenced this issue Mar 29, 2016
…been called

The fix for removing the event callbacks on destroy introduced in
ce7f400 removed the events too early, so that the event callbacks
for the "close" phase in "leave" animations were not called.

This commit fixes the behavior so that the event callbacks are only removed during on('$destroy')
when no animation is currently active on the element. When an animation is active, the event callbacks
will be removed after all callbacks have run, and if the element has no parent (has been removed from
the DOM).

Closes angular#14321
Narretz added a commit to Narretz/angular.js that referenced this issue Apr 7, 2016
…been called

The fix for removing the event callbacks on destroy introduced in
ce7f400 removed the events too early, so that the event callbacks
for the "close" phase in "leave" animations were not called.

This commit fixes the behavior so that the event callbacks are only removed during on('$destroy')
when no animation is currently active on the element. When an animation is active, the event callbacks
will be removed after all callbacks have run, and if the element has no parent (has been removed from
the DOM).

Closes angular#14321
Narretz added a commit that referenced this issue Apr 8, 2016
…been called

The fix for removing the event callbacks on destroy introduced in
ce7f400 removed the events too early, so that the event callbacks
for the "close" phase in "leave" animations were not called.

This commit fixes the behavior so that the event callbacks are only removed during on('$destroy')
when no animation is currently active on the element. When an animation is active, the event callbacks
will be removed after all callbacks have run, and if the element has no parent (has been removed from
the DOM).

Closes #14321
@Narretz Narretz closed this as completed in f8e6a4b Apr 8, 2016
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

3 participants