Skip to content

Instantly share code, notes, and snippets.

@qetr1ck-op
Created September 16, 2015 16:03
Show Gist options
  • Save qetr1ck-op/586b2f682b2aed2039e9 to your computer and use it in GitHub Desktop.
Save qetr1ck-op/586b2f682b2aed2039e9 to your computer and use it in GitHub Desktop.
module.service = function(name, Class) {
provider.provide(name, function() {
this.$get = function($injector) {
return $injector.instantiate(Class);
};
});
}
module.factory = function(name, factory) {
provider.provide(name, function() {
this.$get = function($injector) {
return $injector.invoke(factory);
};
});
}
module.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