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

Hidden ngRepeat elements not being removed from DOM when animations are turned on #5495

Closed
@cfchase

Description

@cfchase

If a list is hidden, but undergoes data changes, the list's scope data that was removed isn't removing the associated DOM elements.

Given an ngRepeat list inside an ngHide:

<div ng-hide="hideList">
  <ul class="example-animate-container">
    <li class="animate-repeat" ng-repeat="friend in friends | filter:q">
      [{{$index}}] {{friend.name}} who is {{friend.age}} years old.
    </li>
  </ul>
</div>

to simulate the problem:

$timeout(function() {$scope.hideList = true;})                    //hide the list
    .then($timeout(function() {$scope.friends = [];}))            //clear the list
    .then($timeout(function() {$scope.hideList = false;}, 1000)); //show after animation

Removing the list's scope data while hideList == true will not remove the DOM elements of the list items. When the list is not hidden anymore, they'll show up again and not have any scope.

Here's the associated plunker with animation css:
http://plnkr.co/edit/SREOUmQ5CG8XiaosTNRU?p=preview

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions