3
我已經包括angular-animate.js
添加動畫類:ngAnimate不NG重複
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/sass-bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/lodash/dist/lodash.compat.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
並將其添加爲一個依賴:
angular.module('myApp', [
'ngRoute',
'ngAnimate'
])
我創建了一個ng-repeat
列表:
<li ng-repeat="result in search.results" class="movie-list__item list-animation">
...
</li>
並定義爲.list-animation
:
.list-animation.ng-enter {
-webkit-transition: 1s linear all; /* Chrome */
transition: 1s linear all;
opacity: 0;
}
.list-animation.ng-enter.ng-enter-active {
opacity: 1;
}
爲什麼它不起作用?看起來ngAnimate
沒有將動畫相關的類放入任何元素中。
AngularJS:1.2.6
角動畫:1.2.9
創建jsffidle'd有很大的幫助在這種情況下。沒有看到問題的實際情況,很難看出問題所在 – dcodesmith