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

angular 1.3.0.rc0: Removing an item from ng-repeat move its DOM element at the end when animating #8918

Closed
pauldijou opened this issue Sep 4, 2014 · 4 comments

Comments

@pauldijou
Copy link
Contributor

Using ng-animate with an ng-repeat, when removing an element from the JavaScript array, I would expect the DOM element to stay at the same place it was while animating and then being removed. That's not what happening with the RC0 of Angular 1.3.

It looks like the DOM element is removed immediately and then Angular realizes it needs to animate it, so the element is put back in the DOM but at the end of the list, animated, and then finally removed for good.

I tried removing using different methods (splice and filter) and using stuff like track by or orderBy but nothing worked. Here is a demo showing the problem: http://codepen.io/pauldijou/pen/wevBr

Am I missing something on how to remove an element from a ng-repeat?

@pauldijou
Copy link
Contributor Author

Little update: it seems to work just fine in beta 18 and previous but broken since beta 19. You can test it by editing the script loading at the top of the HTML pane.

Meaning the bug should be somewhere in there v1.3.0-beta.18...v1.3.0-beta.19 :-)

@Narretz
Copy link
Contributor

Narretz commented Sep 4, 2014

Thanks for reporting. In 1.3.0-beta.19, there was no general animation code, just a few ngRepeat perf optimations; one relates to marking nodes removed by animation: 36e35b2 Could this be the cause @IgorMinar ?

@lgalfaso
Copy link
Contributor

lgalfaso commented Sep 4, 2014

@Narretz it does look like that is the reason. Here 36e35b2#diff-f7b537c61e90325996f3c86b13cd53c4R374, ::parent is not a property of a node, so it should be elementsToRemove[0].parentNode

@IgorMinar
Copy link
Contributor

Oops. I'll fix it today unless someone wants to do it.

IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Sep 9, 2014
IgorMinar added a commit that referenced this issue Sep 9, 2014
…animated away

During the recent refactoring a typo was made that broke code that detects if we are
already removed from the DOM (animation has completed).

Closes #8918
IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Sep 9, 2014
…animated away

During the recent refactoring a typo was made that broke code that detects if we are
already removed from the DOM (animation has completed).

Closes angular#8918
ggershoni pushed a commit to ggershoni/angular.js that referenced this issue Sep 29, 2015
…animated away

During the recent refactoring a typo was made that broke code that detects if we are
already removed from the DOM (animation has completed).

Closes angular#8918
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

4 participants