Iftekharul Islam | f157d37 | 2017-03-08 11:11:27 -0600 | [diff] [blame] | 1 | angular |
| 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 | }) |
Iftekharul Islam | b37fdfb | 2017-07-12 15:36:20 -0500 | [diff] [blame^] | 27 | .when('/unit-id', { |
| 28 | 'templateUrl': 'unit-id.html', |
| 29 | 'controller': 'unitIDController', |
| 30 | authenticated: true |
| 31 | }) |
| 32 | .when('/bmc-reboot', { |
| 33 | 'templateUrl': 'bmc-reboot.html', |
| 34 | 'controller': 'bmcRebootController', |
| 35 | authenticated: true |
| 36 | }) |
Iftekharul Islam | f157d37 | 2017-03-08 11:11:27 -0600 | [diff] [blame] | 37 | .otherwise({ |
| 38 | 'redirectTo': '/login' |
| 39 | }); |
| 40 | }]) |
| 41 | .run(['$rootScope', '$location', 'dataService', |
| 42 | function($rootScope, $location, dataService){ |
| 43 | $rootScope.dataService = dataService; |
| 44 | dataService.path = $location.path(); |
| 45 | $rootScope.$on('$locationChangeSuccess', function(event){ |
| 46 | var path = $location.path(); |
| 47 | dataService.path = path; |
| 48 | if(['/','/login','/logout'].indexOf(path) == -1){ |
| 49 | dataService.showNavigation = true; |
| 50 | }else{ |
| 51 | dataService.showNavigation = false; |
| 52 | } |
| 53 | }); |
| 54 | } |
| 55 | ]); |