Skip to content

Instantly share code, notes, and snippets.

@bioball
Created February 12, 2015 06:12
Show Gist options
  • Save bioball/076b19581f128afe2d0e to your computer and use it in GitHub Desktop.
Save bioball/076b19581f128afe2d0e to your computer and use it in GitHub Desktop.
Angular AUTH example
angular.module('app')
.factory('authentication', [
'user',
function(user){
return {
authentication: function(){
return user.identify();
}
};
}
]);
angular.module('app')
.config([
'$stateProvider',
function($stateProvider){
$stateProvider
.state('home', {
url: '/',
resolve: {
isLoggedIn: {
[
'authentication',
function(authentication){
return authentication.authenticate();
}
]
}
}
}
])
angular.module('app')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment