-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.js
28 lines (26 loc) · 829 Bytes
/
header.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
'use strict';
angular.module('appResume.header', [])
.controller('headerCtrl', ['$scope','$http','$routeParams','$location','$window','$timeout','$compile','$filter', function($scope,$http,$routeParams,$location,$window,$timeout,$compile,$filter) {
console.log('headerCtrl');
/*MENU*/
$scope.loadMenu = function(){
$http.get('menu.json').success(function(data){
// se houver resultado exiba
if(data != ""){
angular.forEach(data, function(item) {
item.url = "#!/"+item.url
});
$scope.menu = data;
} else {
$scope.showError("Erro ao carregar menu");
}
});
$scope.isActive = function (viewLocation) {
var path = ($location.path()).split("/");
path = path[1];
viewLocation = viewLocation.split("/");
viewLocation = viewLocation[1];
return viewLocation === path;
};
}
}]);