myApp.controller("leftmenuController",function($scope, myFactory, $compile){
	$scope.empId = myFactory.getEmpId();
	$scope.empName = myFactory.getEmpName();
	$scope.empEmailId = myFactory.getEmpEmailId();
	$scope.role = myFactory.getEmpRole();
	$scope.menuItems = myFactory.getMenuItems();
	$scope.manageGroup = [];
	$scope.nonManageGroup = [];
	$scope.setTemplateUrl = function(path){
		var element = document.getElementById('main');
		path = "'"+path+"'";
		  var currentEle = event.currentTarget; 
		  $('.navbarMenu').removeClass('activeMenu');
		  $(currentEle).addClass('activeMenu');
		element.setAttribute("ng-include", path);
		var newTemplate = angular.element(element);
		$('#main').html(newTemplate);
		$compile($('#main'))($scope)
	}

			 $scope.manageGroup = [];
			 $scope.nonManageGroup = [];
	    for(var i = 0; i < $scope.menuItems.length; i++){
					if($scope.menuItems[i].menu.indexOf('Manage') !== -1) {
						$scope.manageGroup.push($scope.menuItems[i]);
					}
					else{
						$scope.nonManageGroup.push($scope.menuItems[i]);
					}
			}
	    $scope.custom = true;
			$scope.toggleManage = function(){
				$scope.custom = $scope.custom === false ? true: false;
      
			}

			$scope.togglenonManage = function(){
				if(!$scope.custom){
					$scope.custom = true;
				}

			}
});