drawer-menu.js

angular.module('homepage').
directive('drawerMenu', function () {
	return {
		controller: 'drawerMenuController',
		link: showDrawerLinker,
		restrict: 'E',
		templateUrl: 'components/content-components/drawer/drawer-menu.html'
	}

	function showDrawerLinker(scope, element, attribute) {
		scope.$on('$destroy', function () {
	    	document.querySelector("body").classList.add('noscroll');
	  	});
	}
}).
controller('drawerMenuController', function ($scope) {
	var bodyElement = document.querySelector("body");
	$scope.isPanelVisible = false;
	$scope.showDrawer = function () {
		$scope.isPanelVisible = true;
		bodyElement.classList.add('noscroll');
	};
	$scope.hideDrawer = function () {
		$scope.isPanelVisible = false;
		bodyElement.classList.remove('noscroll');
	};
	$scope.toggleDrawer = function () {
		$scope.isPanelVisible = !$scope.isPanelVisible;
		bodyElement.classList.toggle('noscroll');	
	}
});