"use strict" angular.module('domainManagerApp.userData', []) .service('UserData', [ '$rootScope', function($rootScope) { var user = ''; var isAuthenticated = ""; this.set = function(value1, value2) { user = value1; isAuthenticated = value2; $rootScope.$broadcast('user:isAuthenticated', isAuthenticated); } this.isAuthenticated = function() { return isAuthenticated; } this.getUser = function() { return user; } }]);