-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
executable file
·100 lines (91 loc) · 2.83 KB
/
main.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
(function() {
'use strict';
var mdash = 'Aahho - '
//Create a app level module which has dependencies on controllers and components
var aahhoWeb =
angular.module('ngSeedApp', [
'ui.router',
'ngSeedApp.controllers',
'simple-slideshow',
'firebase'
]);
aahhoWeb
.config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider.state("home", {
url: "/",
controller: 'homeController',
templateUrl: 'views/home.html',
data : { pageTitle: mdash + 'Home' }
}).state("work", {
url: "/work",
data : { pageTitle: mdash + 'Work' },
controller: 'workController',
templateUrl: 'views/work.html'
}).state("services", {
url: "/services",
data : { pageTitle: mdash + 'Services' },
controller: 'servicesController',
templateUrl: 'views/services.html'
}).state("products", {
url: "/products",
data : { pageTitle: mdash + 'Product' },
controller: 'productsController',
templateUrl: 'views/products.html'
}).state("about", {
data : { pageTitle: mdash + 'About' },
url: "/about",
controller: 'aboutController',
templateUrl: 'views/about.html'
}).state("contact", {
data : { pageTitle: mdash + 'Contact' },
url: "/contact",
controller: 'contactController',
templateUrl: 'views/contact.html'
});
}
])
.run(['$rootScope', '$state', '$stateParams',
function($rootScope, $state, $stateParams) {
//Add references to $state and $stateParams to the $rootScope
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
$rootScope.$on('$stateChangeStart', function (event) {
console.log('state change started');
var sidebar = $('.sidebar');
var em = sidebar.find('#sidebar-btn');
if(sidebar.hasClass('sidebar-sm')) {
sidebar.removeClass('sidebar-sm');
em.removeClass('fa-times');
em.addClass('fa-bars');
}
});
// $rootScope.$on('$stateChangeSuccess', function (event) {
// console.log('state change success');
// var sidebar = $('.sidebar');
// if(sidebar.hasClass('sidebar-sm')) {
// sidebar.removeClass('sidebar-sm');
// }
// });
$rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
$rootScope.title = current.$$route.title;
});
$rootScope.toggleSidebar = function ($event) {
// console.log($event);
var sidebar = $('.sidebar');
var em = sidebar.find('#sidebar-btn');
console.log(em);
if(sidebar.hasClass('sidebar-sm')) {
sidebar.removeClass('sidebar-sm');
em.removeClass('fa-times');
em.addClass('fa-bars');
} else {
sidebar.addClass('sidebar-sm');
em.removeClass('fa-bars');
em.addClass('fa-times');
}
};
}
]);
}());