<div ng-app="myApp">
<div ng-controller="myCtrl">
<button ng-click="toggle()">Toggle Animation</button>
<div class="box" ng-class="{'animate': animate}"></div>
</div>
</div>
.box {
width: 100px;
height: 100px;
background: blue;
transition: all 0.3s ease;
}
.animate {
background: red;
}
angular.module('myApp', ['ngAnimate'])
.controller('myCtrl', function($scope) {
$scope.animate = false;
$scope.toggle = function() {
$scope.animate = !$scope.animate;
};
});
<script src="angular.js"></script>
<script src="angular-animate.js"></script>