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.
ngIf directive element not removed on falsy #5241
Closed
Description
AngularJS version 1.2.2 in Chrome Version 31.0.1650.57 on OSX Maverick
I haven't gotten down to the exact source yet but just adding this here as a note for the animation team. I had a situation today where the animation classes where being applied to an ngIf directive even though I had no animation set on it either via css or js. To complicate things even more the element with the ngIf never got removed from the DOM even if the ngIf expression resoled to false. The root of this issue was a vanilla css transition (not via ngAnimate) that was set on the element. Seems like the the leave hung at step 7 (from docs) where it was waiting for the transition to complete and got hung up.
Summary:
- still can't explain why the $animte service got triggered in this element... not sure how each animation is registered with the service solely on css classes. Removed any classes I had set on the element to make sure there was no collision but was still an issue.
- issue where the ngIf got hung and never finished removing the element from the DOM because there was a css transition set on the element. Once I removed the culprit transition declaration everything worked fine.
DOM structure example: (scope.currentPage is an int)
<div>
<ul ng-repeat="page in pages">
<li ng-repeat="item in page" ng-if="$parent.$index == currentPage">item</li>
<ul>
</div>