I'm making a basic AngularJS application. Now I want to do an animation between my views. But it won't work, the animation is not triggering. I followed the tutorial on the AngularJS website. I'm probably missing something, I also have no errors in my console.
router.js
(function (app) {
app.config(function ($routeProvider, $locationProvider) {
$routeProvider.when('/home', {
controller: 'homeController',
templateUrl: 'home.html'
}).when('/product', {
controller: 'productController',
templateUrl: 'products.html'
}).otherwise({
redirectTo: '/home'
});
});
}(angular.module('myApp', ['ngRoute'])));
homeController.js (productcontroller is basically the same)
(function (app) {
var homeController = function ($scope) {
$scope.title = "Test";
}
app.controller('homeController', ["$scope", homeController]);
}(angular.module('myApp')));
I registered my module in app.js:
(function () {
angular.module('myApp', ['ngAnimate']);
}());
In my index.html file I include these resources:
<script src="scripts/angular.min.js"></script>
<script src="scripts/angular-animate.js"></script>
<script src="scripts/angular-route.js"></script>
<script src="myApp/app.js"></script>
<script src="myApp/router.js"></script>
<script src="myApp/controllers/homeController.js"></script>
<script src="myApp/controllers/productController.js"></script>
I think this setup is ok, everything works except the animation. I'm doing the animation in index.html as follows:
<style type="text/css">
.reveal-animation.ng-enter {
-webkit-animation: enter_sequence 1s linear; /* Safari/Chrome */
animation: enter_sequence 1s linear; /* IE10+ and Future Browsers */
}
@-webkit-keyframes enter_sequence {
from { opacity:0; }
to { opacity:1; }
}
@keyframes enter_sequence {
from { opacity:0; }
to { opacity:1; }
}
</style>
<div ng-view class="reveal-animation"></div>
I can't see what I'm doing wrong to make these animations work.
Version: Angular version: 1.2.5 singularity-expansion
Browser: tested in Chrome, FF and IE