1window.angular && (function (angular) { 2 'use strict'; 3 4 angular 5 .module('app.common.directives') 6 .directive('appNavigation', function () { 7 return { 8 'restrict': 'E', 9 'templateUrl': 'common/directives/app-navigation.html', 10 'scope': { 11 'path': '=', 12 'showNavigation': '=' 13 }, 14 'controller': ['$scope', '$location', 'dataService', function($scope, $location, dataService){ 15 $scope.change = function(firstLevel){ 16 $scope.firstLevel = firstLevel; 17 //$location.path('/'+firstLevel); 18 }; 19 $scope.closeSubnav = function(){ 20 $scope.firstLevel = ''; 21 }; 22 $scope.$watch('showNavigation', function(){ 23 var paddingTop = 0; 24 // var urlRoot = $location.path().split("/")[1]; 25 // if(urlRoot != ""){ 26 // $scope.firstLevel = urlRoot; 27 // }else{ 28 // $scope.firstLevel = 'overview'; 29 // } 30 31 if($scope.showNavigation){ 32 paddingTop = document.getElementById('header__wrapper').offsetHeight; 33 } 34 dataService.bodyStyle = {'padding-top': paddingTop + 'px'}; 35 $scope.navStyle = {'top': paddingTop + 'px'}; 36 }); 37 }] 38 }; 39 }); 40})(window.angular); 41