I'm learning AngularJS and I noticed that A Factory is a short-hand for a Provider. Can you tell me specific scenarios where I should/must use a Provider instead of a Factory? The codes stays much more readable if use a Factory method instead of the provider.
Asked
Active
Viewed 242 times
1
-
http://stackoverflow.com/questions/15666048/angular-js-service-vs-provider-vs-factory – calebboyd Apr 02 '14 at 21:50
1 Answers
1
A Provider is necessary when the provider itself has methods that you want the user of your service to call during the configuration phase of the application.
See for example the $location
service: it has a $locationProvider
which allows setting it to html5 mode, while the application is being configured (using module.config()
).

JB Nizet
- 678,734
- 91
- 1,224
- 1,255