Skip to content

Instantly share code, notes, and snippets.

@iissnan
Created December 12, 2013 07:29
Show Gist options
  • Save iissnan/7924379 to your computer and use it in GitHub Desktop.
Save iissnan/7924379 to your computer and use it in GitHub Desktop.
Function Defines
provider(name, Object OR constructor()) A configurable service with complex creation logic. If you pass an Object, it should have a function named $get that returns an instance of the service. Otherwise, Angular assumes you’ve passed a constructor that, when called, creates the instance.
factory(name, $get Function()) A non-configurable service with complex creation logic. You specify a function that, when called, returns the service instance. You could think of this as provider(name, { $get: $getFunction() } ).
service(name, constructor()) A non-configurable service with simple creation logic. Like the constructor option with provider, Angular calls it to create the service instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment