我無法獲得簡單的角度動畫。我做了一個簡單的Plunkr顯示它:https://plnkr.co/edit/bKZev3i1WhNgKhsWOZIQngAnimate不再工作了嗎?
HTML
<head>
<link rel="stylesheet" href="style.css">
<script src="angular.js"></script>
<script src="angular-animate.js"></script>
<script src="script.js"></script>
</head>
<body data-ng-app="myApp">
<div data-ng-controller="myCtrl">
<p class="fade-fx" data-ng-repeat="text in texts">{{ text.text }}</p>
</div>
</body>
CSS
.fade-fx.ng-enter,
.fade-fx.ng-leave {
-webkit-transition: 1s linear all;
transition: 2s linear all;
}
.fade-fx.ng-enter,
.fade-fx.ng-leave.ng-leave-active {
opacity: 0;
}
.fade-fx.ng-leave,
.fade-fx.ng-enter.ng-enter-active {
opacity: 1;
}
JS
angular.module('myApp', ['ngAnimate']);
angular.module('myApp')
.controller('myCtrl', function($scope) {
$scope.texts = [
{
text: 'text1'
},
{
text: 'text2'
},
{
text: 'text3'
}
];
});
事情是我不知道我做錯了什麼。有任何想法嗎?
ngAnimate從來沒有真正奏效。 – LoremIpsum