ngAnimateSwap is a animation-oriented directive that allows for the container to
be removed and entered in whenever the associated expression changes. A
common usecase for this directive is a rotating banner or slider component which
contains one image being present at a time. When the active image changes
then the old image will perform a leave
animation and the new element
will be inserted via an enter
animation.
<ANY>
...
</ANY>
Animation | Occurs |
---|---|
enter | when the new element is inserted to the DOM |
leave | when the old element is removed from the DOM |
<div class="container" ng-controller="AppCtrl">
<div ng-animate-swap="number" class="cell swap-animation" ng-class="colorClass(number)">
{{ number }}
</div>
</div>