I want to animate the showing and hiding of an element using animate.css and angular.
I have read this SO question and the angular documentation for ngShow and ngAnimate but still cannot get it to work.
I have tried the following setup on plunker, but it doesn't work.
app.js
var app = angular.module('plunker', ['ngAnimate']); app.controller('MainCtrl', function($scope) { $scope.show = true; }); index.html
<body ng-controller="MainCtrl"> <p>Show: {{show}}</p> <div class="show" ng-click="show = !show" ng-show="show === true">Show is true</div> <div class="hide" ng-click="show = !show" ng-show="show === false">Show is false</div> </body> style.css
.show.ng-hide-add { animation: fadeOut 5s linear; } When clicking on "show is true" (and therefor hiding it) I see it wait for 5 second before hiding, so there is something happening, but it doesn't fade out.
I can make it work if I add this to the css:
.show.ng-hide-add { opacity: 1.0; display: block !important; transition: opacity 1s; } .show.ng-hide-add-active { opacity: 0; } However, I don't want to do it this way. I want to use animate.css's keyframes (I think that's the correct term, my css lingo isn't brilliant) such as fadeIn, fadeOut etc..
plunker to show what I am seeing.
What am I doing wrong? How can I use animate.css's keyframe animations with angular's ngAnimate?