Skip to content

Instantly share code, notes, and snippets.

@AnalogJ
Created July 21, 2013 03:03
Show Gist options
  • Save AnalogJ/6047309 to your computer and use it in GitHub Desktop.
Save AnalogJ/6047309 to your computer and use it in GitHub Desktop.
AngularJS Dependency Injection for provider.
angular.module('security.authorization', ['security.service'])
// You can add them as resolves to routes to require authorization levels
// before allowing a route change to complete
.provider('securityAuthorization', {
requireUser: ['securityAuthorization', function(securityAuthorization) {
return securityAuthorization.requireUser();
}],
$get: ['security', 'securityRetryQueue', function(security, queue) {
var service = {
requireUser: function() {
//Stuff ...
return true;
};
return service;
}]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment