Use $document instead of document for on fn

Signed-off-by: gconsidine <greg@gregconsidine.com>
This commit is contained in:
gconsidine
2017-10-02 11:42:11 -04:00
parent ca4a1f37cd
commit f49ed838c7

View File

@@ -1,9 +1,11 @@
const templateUrl = require('~components/layout/side-nav.partial.html');
let $document;
function atSideNavLink (scope, element, attrs, ctrl) {
scope.layoutVm = ctrl;
document.on('click', (e) => {
$document.on('click', (e) => {
if ($(e.target).parents('.at-Layout-side').length === 0) {
scope.$emit('clickOutsideSideNav');
}
@@ -35,7 +37,9 @@ function AtSideNavController ($scope, $window) {
AtSideNavController.$inject = ['$scope', '$window'];
function atSideNav () {
function atSideNav (_$document_) {
$document = _$document_;
return {
restrict: 'E',
replace: true,
@@ -50,4 +54,6 @@ function atSideNav () {
};
}
atSideNav.$inject = ['$document'];
export default atSideNav;