Adding angular support
Change-Id: I88c1211d661b2c77bcf6b99ceb1fbf2c2eae139c
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/src/js/app.js b/src/js/app.js
new file mode 100644
index 0000000..6469860
--- /dev/null
+++ b/src/js/app.js
@@ -0,0 +1,45 @@
+angular
+ .module('app', [
+ 'ngRoute',
+ 'app.directives',
+ 'app.services',
+ 'app.controllers'
+ ])
+ .config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){
+ $locationProvider.hashPrefix('');
+ $routeProvider
+ .when('/login', {
+ 'templateUrl': 'login.html',
+ 'controller': 'loginController'
+ })
+ .when('/dashboard', {
+ 'templateUrl': 'dashboard.html',
+ 'controller': 'dashboardController'
+ })
+ .when('/power-operations', {
+ 'templateUrl': 'power-operations.html',
+ 'controller': 'powerOperationsController'
+ })
+ .when('/system-overview', {
+ 'templateUrl': 'system-overview.html',
+ 'controller': 'systemOverviewController'
+ })
+ .otherwise({
+ 'redirectTo': '/login'
+ });
+ }])
+ .run(['$rootScope', '$location', 'dataService',
+ function($rootScope, $location, dataService){
+ $rootScope.dataService = dataService;
+ dataService.path = $location.path();
+ $rootScope.$on('$locationChangeSuccess', function(event){
+ var path = $location.path();
+ dataService.path = path;
+ if(['/','/login','/logout'].indexOf(path) == -1){
+ dataService.showNavigation = true;
+ }else{
+ dataService.showNavigation = false;
+ }
+ });
+ }
+ ]);