Timeline for AngularJS: Service vs provider vs factory
Current License: CC BY-SA 3.0
35 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 6, 2020 at 9:55 | comment | added | Snackoverflow |
Wait... provider.provide and provide.provider? This is so confusing.. Could there be a better name for the modules, like myModule? And what is that provider variable in the end? Also a module or? Please, could someone edit this so that all the custom variable, function and instance names used are unique by purpose?
|
|
| Jun 20, 2020 at 9:12 | history | edited | Community Bot |
Commonmark migration
|
|
| Apr 19, 2017 at 18:53 | comment | added | user2503764 | @KylePennell Sounds like you might want to look into the concept of a "Factory" in OOP context. If you are familiar, the uses are obvious, but in a nut-shell, Factories create and provide things (objects) and Services do things to objects you provide. Factories are functions that return objects. Services are functions you call [and pass objects to]. Hope that helps. | |
| Jan 31, 2016 at 23:34 | history | edited | amanuel2 | CC BY-SA 3.0 |
added 1 character in body
|
| Nov 25, 2015 at 7:31 | history | edited | Royi Namir | CC BY-SA 3.0 |
added 8 characters in body
|
| Aug 28, 2015 at 13:42 | comment | added | Hemant | It took me some time to figure out that for the provider, two objects get created, one 'greeter2Provider' and 'greeter2'. First being the provider itself which is by appending 'Provider' to the name supplied and 'greeter2' being the return value of $get, same as the name supplied. Why is this syntax followed only for provider? Why not automatically add Service or Factory suffixes as well? just to make this consistent. | |
| Jul 19, 2015 at 15:52 | history | edited | KlwntSingh | CC BY-SA 3.0 |
added 3 characters in body
|
| Jun 14, 2015 at 7:11 | comment | added | Kirill Slatin |
@AdamZerner, I find the diagram misleading in section for providers. This code won't even compile in Angular, because a provider must define $get
|
|
| Dec 13, 2014 at 16:59 | history | edited | Peter Mortensen | CC BY-SA 3.0 |
More representative link text, etc.
|
| Oct 3, 2014 at 20:23 | comment | added | Craig | Using the function expect() is a poor choice to explain something. Use real world code next time. | |
| Aug 6, 2014 at 18:35 | comment | added | Kyle Pennell |
This example could be incredible if it used a clear practical example. I get lost trying to figure out what the point of things like toEqual and greeter.Greet is. Why not use something slightly more real and relatable?
|
|
| Jul 1, 2014 at 9:26 | history | edited | Jeroen Vannevel | CC BY-SA 3.0 |
deleted 3 characters in body
|
| Apr 20, 2014 at 13:17 | history | edited | Herb Caudill | CC BY-SA 3.0 |
Cleanup
|
| Mar 18, 2014 at 19:25 | comment | added | martinoss | See also docs.angularjs.org/guide/providers there is a good overview on the official Angular site. | |
| Mar 18, 2014 at 15:06 | comment | added | Phương Nguyễn |
The statement about module.service that you will get new FunctionYouPassedToService() is not always true. If FunctionYouPassedToService() return an object or function, it will be returned as the injectable service, just like module.factory.
|
|
| Feb 12, 2014 at 6:02 | history | edited | ledzep2 | CC BY-SA 3.0 |
There should be no new before the ProviderFunction. As in here: https://github.com/angular/angular.js/wiki/Understanding-Dependency-Injection#wiki-the-provider-provide
|
| Dec 15, 2013 at 6:17 | comment | added | angelokh | Although a service is called by creating an instance of the function. It is actually created only once per injector which makes it like singleton.docs.angularjs.org/guide/dev_guide.services.creating_services | |
| Nov 15, 2013 at 22:17 | history | edited | Francisc | CC BY-SA 3.0 |
Bolded provider return for consistency.
|
| Oct 12, 2013 at 18:35 | history | edited | Sangram Singh | CC BY-SA 3.0 |
making language clearer
|
| Oct 12, 2013 at 3:50 | history | edited | okm | CC BY-SA 3.0 |
fix typo
|
| Oct 9, 2013 at 13:41 | history | edited | Minko Gechev | CC BY-SA 3.0 |
deleted 3 characters in body; Post Made Community Wiki
|
| Aug 16, 2013 at 12:54 | history | edited | roryf | CC BY-SA 3.0 |
typo in code example
|
| S Aug 1, 2013 at 16:32 | history | suggested | Jason Capriotti | CC BY-SA 3.0 |
Corrected spelling
|
| Aug 1, 2013 at 16:28 | review | Suggested edits | |||
| S Aug 1, 2013 at 16:32 | |||||
| Jul 8, 2013 at 15:30 | comment | added | Nick | In edit 611 I added usage of angular constants and values. To demonstrate the differences of the the other's already shown. jsbin.com/ohamub/611/edit | |
| May 16, 2013 at 15:45 | history | edited | maxisam | CC BY-SA 3.0 |
reformat code block to avoid horizontal scrollbars
|
| May 6, 2013 at 19:45 | review | Suggested edits | |||
| May 6, 2013 at 19:49 | |||||
| May 1, 2013 at 19:23 | vote | accept | Lior | ||
| Apr 25, 2013 at 11:34 | review | Suggested edits | |||
| Apr 25, 2013 at 11:39 | |||||
| Apr 16, 2013 at 21:53 | history | edited | Lior | CC BY-SA 3.0 |
added 26 characters in body
|
| S Apr 9, 2013 at 14:34 | history | edited | Luiggi Mendoza | CC BY-SA 3.0 |
seperated code from explanations so you don't need to scroll
|
| S Apr 9, 2013 at 14:34 | history | suggested | justGoscha | CC BY-SA 3.0 |
seperated code from explanations so you don't need to scroll
|
| Apr 9, 2013 at 14:31 | review | Suggested edits | |||
| Apr 9, 2013 at 14:34 | |||||
| Mar 27, 2013 at 18:10 | comment | added | Mark Rajcok | See also stackoverflow.com/a/13763886/215945 which discusses the differences between service and factory. | |
| Mar 27, 2013 at 17:59 | history | answered | Lior | CC BY-SA 3.0 |