I have an AngularJS 1.2.2 web application with a <div>
that I show/hide based on some $scope
property. Using the ngAnimate
module, I animate the showing and hiding of the <div>
.
<div id="square" ng-show="showSquare" class="animate-shiny"></div>
I also have a class I want to place on this <div>
and for this I use ngClass
.
<div id="square" ng-show="showSquare" class="animate-shiny" ng-class="{ cool: extraCool }"></div>
And as it so happens, sometimes that class gets applied at the same moment as when the <div>
is shown/hidden. This causes the show/hide animation to not work anymore, apparantly it finds ngClass
more interesting to animate, even though I don't want to use ngAnimate
for that animation.
Here's a Plnkr that demonstrates the behavior. Clicking the show/hide button works great, clicking the make cool button works great, but the button that combines these two causes the show/hide animation to break.
How do I fix this? And can I do it without manually addressing $animate
?
Thanks in advance!