blob: 6469860dded35d15fdc09cf683b2cb0fee0ec6b1 [file] [log] [blame]
Iftekharul Islamf157d372017-03-08 11:11:27 -06001angular
2 .module('app', [
3 'ngRoute',
4 'app.directives',
5 'app.services',
6 'app.controllers'
7 ])
8 .config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){
9 $locationProvider.hashPrefix('');
10 $routeProvider
11 .when('/login', {
12 'templateUrl': 'login.html',
13 'controller': 'loginController'
14 })
15 .when('/dashboard', {
16 'templateUrl': 'dashboard.html',
17 'controller': 'dashboardController'
18 })
19 .when('/power-operations', {
20 'templateUrl': 'power-operations.html',
21 'controller': 'powerOperationsController'
22 })
23 .when('/system-overview', {
24 'templateUrl': 'system-overview.html',
25 'controller': 'systemOverviewController'
26 })
27 .otherwise({
28 'redirectTo': '/login'
29 });
30 }])
31 .run(['$rootScope', '$location', 'dataService',
32 function($rootScope, $location, dataService){
33 $rootScope.dataService = dataService;
34 dataService.path = $location.path();
35 $rootScope.$on('$locationChangeSuccess', function(event){
36 var path = $location.path();
37 dataService.path = path;
38 if(['/','/login','/logout'].indexOf(path) == -1){
39 dataService.showNavigation = true;
40 }else{
41 dataService.showNavigation = false;
42 }
43 });
44 }
45 ]);