var myModule = angular.module('myModule', ['ngAnimate']);
<div ng-app="myModule" ng-init="addNewClass=false"> <button ng-click="addNewClass=!addNewClass">Toggle Class</button> <div ng-class="{addNewClass:addNewClass}" class="my-toggle-animation"> Lorem ipsum dolor sit amet, consectetur adipiscing elit... </div> </div>
.my-toggle-animation { -webkit-transition:0.5s linear all; transition:0.5s linear all; background:white; padding:10px; border:1px solid black; color:black; } .my-toggle-animation.addNewClass { background: #5b86c7; color:#fff; border-color:#496ca0; }