ng-animate on ng-view doesn't remove previous page content with firefox
Here is a fiddle to see the bug in action: http://jsfiddle.net/qSBHE/10/
When you navigate between pages with chrome and had a look at the source page, you will only see the destination page content. Ex:
<div ng-view="" ng-animate="'flip'">
<a href="#/page2" class="ng-scope">page 2</a>
</div>
but when you do the same thing with firefox, all pages are append. Ex:
<div ng-animate="'flip'" ng-view="">
<a href="#/page1" class="flip-enter-setup ng-scope flip-enter-start flip-leave-setup flip-leave-start">page 1</a>
<a href="#/page2" class="flip-enter-setup ng-scope flip-enter-start flip-leave-setup flip-leave-start">page 2</a>
<a href="#/page3" class="flip-enter-setup ng-scope flip-enter-start flip-leave-setup flip-leave-start">page 3</a>
<a href="#/page2" class="flip-enter-setup ng-scope flip-enter-start flip-leave-setup flip-leave-start">page 2</a>
<a href="#/page3" class="flip-enter-setup ng-scope flip-enter-start flip-leave-setup flip-leave-start">page 3</a>
<a href="#/page1" class="flip-enter-setup ng-scope flip-enter-start">page 1</a>
</div>
+1 -- did not expect anything this bad when checking my ng-animates in FF. Sheesh!
This looks like a bug with the transition end event -- check out my updated fiddle which works:
http://jsfiddle.net/qSBHE/16/
@klebba your fiddle doesn't work for me. Ok, the page 1 is not anymore visible but if I go to page 2 then inspect the source, I can see that the link is still here as you can see on the attached screenshot.

Sorry -- I updated the fiddle to 16, but I'm guessing when GitHub emailed you it was still 13 -- try this:
http://jsfiddle.net/qSBHE/16/
Basically I could reproduce/eliminate the problem by adding/removing the 'leave' transition in FF. It seems like a bug in Angular related to CSS transitions. I will continue to investigate but I did see that the Yearofmoo demonstration app also does not use the 'leave' transition on ng-view so it might be known already by @matsko -- though I havent seen any reported issues that are obviously related. I wound up doing this in my controller:
$scope.leaveAni = $sniffer.vendorPrefix === 'Webkit' ? 'view-leave' : false;
and this in my view:
<div ng-view ng-animate="{enter:'view-enter',leave:leaveAni}"></div>
$sniffer is an undocumented service available in the Angular core. Not ideal!
--C
@jmeiss -- check this fiddle I made:
http://jsfiddle.net/klebba/7Bw8W
I'm using a service to watch the transitionEnd event in JavaScript and manipulate the CSS classnames in the same way as the default behavior. You can drop this service into your project transparently until there is a fix.
If you have any questions, don't hesitate to ask!
--C
It seems to be a good workaround and I will probably use it when I will add animation to my application ;)
(it was only a POC)
Thank you very much!
+1 ngAnimate is useless until this is fixed
As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.
Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.
Thanks!
This is happening for me. When I define css for .ng-enter and/or .ng-leave on [ng-view], my views are appended one after the other in Firefox, and do not remove. When I don't define the classes, things work normally. Adding the animations kills whatever logic exists to remove a view that has "left."
I have this problem. Everything works perfectly in chrome, however in firefox ng-views are appended one after the other.
Any fix?
Right now ngAnimate has a big refactoring going on. I'm happy to deal with this directly during that refactor. Seeing as it is still an issue, I'm going to reopen this.
I just found out that the problem was a failure within a directive. I have element.on ('$ destroy', function () { document.removeEventListener (visibilityChange); });
In firefox, two arguments is necessary in removeEventListener and the transition stopped.
Thanks and sorry.
OK. Thanks for the info. Why did you not use $(document).off(...) instead?
Yes, i should use that.
Thanks.
@matsko - can we put this in a milestone? If you are actively working on it then I would think 1.4.x or even 1.4.0-beta.3 / 1.3.12
I am experiencing the same issue in both chrome and firefox. I am using version 1.2.19.
Same here, even with latest v1.4.0-beta.5
@matsko - is this fixed with the new animation engine?
By the looks of it, things are working as expected with 1.4:
http://plnkr.co/edit/38upnPJqcLdMGUkoveZn?p=preview
And with 1.3:
http://plnkr.co/edit/5sjlneFawUPU52CURl3V?p=preview
Am I missing something here? It looks like the views are being removed correctly in both versions on Chrome and Firefox.
I'm closing this issue for now since I can't get a reproduction to work. Please reopen if it's still an issue.