Skip to content

Instantly share code, notes, and snippets.

@lamba
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lamba/c275f5f010090632209e to your computer and use it in GitHub Desktop.
Save lamba/c275f5f010090632209e to your computer and use it in GitHub Desktop.
angular
.module('...', [...])
...
.controller('SomeController', ['$scope', '$location', LoggedInUser])
.factory('Util', Util);
function Util($scope, $location, LoggedInUser) {
console.log('logout');
return {
logout: function() {
LoggedInUser.setEmail('');
console.log('LoggedInUser.getEmail()='+LoggedInUser.getEmail());
$location.path('#home');
}
};
};
function SomeController($scope, $location, LoggedInUser) {
...
Util.logout($scope, $location, LoggedInUser);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment