Skip to content

Instantly share code, notes, and snippets.

@stevenh77
Created November 5, 2014 11:31
Show Gist options
  • Select an option

  • Save stevenh77/1c41c50a4181f0d516d1 to your computer and use it in GitHub Desktop.

Select an option

Save stevenh77/1c41c50a4181f0d516d1 to your computer and use it in GitHub Desktop.
provider.service = function(name, Class) {
provider.provide(name, function() {
this.$get = function($injector) {
return $injector.instantiate(Class);
};
});
}
provider.factory = function(name, factory) {
provider.provide(name, function() {
this.$get = function($injector) {
return $injector.invoke(factory);
};
});
}
provider.value = function(name, value) {
provider.factory(name, function() {
return value;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment