动画

ng-enter 元素创建

ng-leave 元素销毁

<style>
    div{width:150px;height:150px;background:red;}
    .fade{transition:1s linear all}
    .fade.ng-enter{opacity:0}
    .fade.ng-enter.ng-enter-acitve{opacity:1}
    .fade.ng-leave{opacity:1}
    .fade.ng-leave.ng-leave-active{opacity:0}
</style>
<div ng-if="show" class="fade"></div>
<button ng-click="show=!show">toggle</button>

动画_第1张图片

你可能感兴趣的:(动画)