-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
executable file
·68 lines (58 loc) · 1.85 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var animateApp = angular.module('animateApp', ['ngRoute', 'ngAnimate']);
animateApp.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'page-home.html',
controller: 'mainController'
})
.when('/about', {
templateUrl: 'page-about.html',
controller: 'aboutController'
})
.when('/sound', {
templateUrl: 'page-sound.html',
controller: 'soundController'
})
.when('/vision', {
templateUrl: 'page-vision.html',
controller: 'visionController'
})
.when('/dates', {
templateUrl: 'page-dates.html',
controller: 'datesController'
})
.when('/contact', {
templateUrl: 'page-contact.html',
controller: 'contactController'
});
// use the HTML5 History API
// $locationProvider.html5Mode(true);
});
// This is the key to view transition happiness!
//from: https://codepen.io/mike360/pen/xjFIJ
//https://medium.com/@mike360/animating-ng-view-on-route-change-in-angularjs-9490811d0470
animateApp.run(function ($rootScope, $timeout, $window) {
$rootScope.$on('$routeChangeSuccess', function () {
$timeout(function () {
$window.scrollTo(0,0);
}, 100);
});
});
animateApp.controller('mainController', function($scope) {
$scope.pageClass = 'page-home';
});
animateApp.controller('aboutController', function($scope) {
$scope.pageClass = 'page-about';
});
animateApp.controller('soundController', function($scope) {
$scope.pageClass = 'page-sound';
});
animateApp.controller('visionController', function($scope) {
$scope.pageClass = 'page-vision';
});
animateApp.controller('datesController', function($scope) {
$scope.pageClass = 'page-dates';
});
animateApp.controller('contactController', function($scope) {
$scope.pageClass = 'page-contact';
});