# Pastebin TmCPd3lH angular.module("employeeModule").factory("referenceGuideService", function ($timeout, $http, employeeService, $rootScope) { function canViewReferenceGuide(cb) { cb(($rootScope.currentUser.EmployeeID === $rootScope.selectedEmployee.EmployeeID || $rootScope.currentUser.Roles.indexOf("CanViewAllReferenceGuides") !== -1) ) } function canViewCheckBox() { var canSee = $rootScope.currentUser.employeeID == $rootScope.selectedEmployee.employeeID; console.log(canSee); return canSee; } let shared = { canViewCheckBox: canViewCheckBox } const service = { canViewReferenceGuide, shared, } return service; });