The Difference Between Angular Service and Angular Factory Service

  Рет қаралды 58,719

Programming

Programming

Күн бұрын

Пікірлер: 52
@crysknife007
@crysknife007 9 жыл бұрын
Finally after watching your video I understand the difference. Thanks!
@Akshay-nl2cy
@Akshay-nl2cy 8 жыл бұрын
Finally after a long struggle to get the concept,understood clearly here...very much thank u sir...
@Swanidhi
@Swanidhi 9 жыл бұрын
Service service does the service but the service factory service doesn't, so service service service service! :P Subscribed!
@PieEatinSuicideGrunt
@PieEatinSuicideGrunt 9 жыл бұрын
+Swanidhi Singh Ah that makes sense now! The addTodo inside a service should just adds a todo to the todoArray (or whatever it's called), while the addTodo inside the factory makes a new todo. This is correct right? If so, does that mean you are supposed to use both the factory and the service? (i.e. factory for creation, and service for adding to array).
@toby1kenobe
@toby1kenobe 8 жыл бұрын
no, dont use both! I think the short story is that if you want to return a function from your service you must use a factory. Otherwise a service will do.
@UBOATss
@UBOATss 9 жыл бұрын
I believe there is much more to this than in the video. Let say you store 100K records into a service, this will never be garbage collected and stay resident into the browser's memory since the Service is a Singleton. Now when you create a Factory with the new keyword you are storing a Singleton into a private variable which is collected by the garbage collector thus the 100K records will be destroyed once the controller is finished.
@humaripragati
@humaripragati 7 жыл бұрын
What a super video. I have went through many blogs but my search ended here for this
@AIWorkflows
@AIWorkflows 9 жыл бұрын
I have really been wondering about this, great video.
@alejandrov444
@alejandrov444 9 жыл бұрын
btw, what do you use to record your videos?
@mahakjain4121
@mahakjain4121 7 жыл бұрын
Thanks for the video. Understood the benefit of factory over service that we can use it to return a function. But still not clear with purpose of service over a factory. If we can return object as well as function both from a factory why to use service then?
@yeshwanthchowdary
@yeshwanthchowdary 8 жыл бұрын
Perfect example. Thank you
@stefaniehall5341
@stefaniehall5341 8 жыл бұрын
Wonderfully simple. Thank you.
@20Raghu
@20Raghu 9 жыл бұрын
Great video.And what is the IDE that you are using?
@SarathKumars
@SarathKumars 9 жыл бұрын
+Raghu webstorm
@stephanecastellani2140
@stephanecastellani2140 8 жыл бұрын
Excellent explanation, thanks
@BrianGentles
@BrianGentles 9 жыл бұрын
Great video but where have all the semi-colons gone
@Mateush53
@Mateush53 9 жыл бұрын
+Brian Gentles JS have feature called automatic semicolon insertion, therefor semicolons are optional.
@denicho2397
@denicho2397 8 жыл бұрын
What text editor is this?
@BinLiutrianglehomes
@BinLiutrianglehomes 8 жыл бұрын
great tutorial!!! Thank you!
@MikeMonji
@MikeMonji 8 жыл бұрын
What did semicolons ever do to you?
@mahluleligoodson
@mahluleligoodson 8 жыл бұрын
The whole tutorial felt like a decade because of that #lol
@Patrk38
@Patrk38 7 жыл бұрын
semicolons are useless in JS
@Skaxarrat
@Skaxarrat 7 жыл бұрын
Semicolons are // Not implemented
@Wolinho
@Wolinho 9 жыл бұрын
Perfectly explained - thank you!
@terrellisaias4279
@terrellisaias4279 3 жыл бұрын
i realize Im pretty randomly asking but does anyone know of a good site to stream new movies online ?
@felixjoseph8815
@felixjoseph8815 3 жыл бұрын
@Terrell Isaias Meh lately I've been using Flixportal. just search on google for it:P -felix
@terrellisaias4279
@terrellisaias4279 3 жыл бұрын
@Felix Joseph thank you, I signed up and it seems like a nice service =) I appreciate it !!
@felixjoseph8815
@felixjoseph8815 3 жыл бұрын
@Terrell Isaias No problem :D
@ShaikhAhmedReza786
@ShaikhAhmedReza786 6 жыл бұрын
well explained
@Lina-mb3vt
@Lina-mb3vt 8 жыл бұрын
thanks for the video, that was really helpful :)
@alejandrov444
@alejandrov444 9 жыл бұрын
Greaaaaaaat video! Thanks
@vibhatha
@vibhatha 8 жыл бұрын
Awesome and really cool :)
@stanislautsishkou5632
@stanislautsishkou5632 8 жыл бұрын
much clear, thx
8 жыл бұрын
So... Angular services are singletons, and factories are multi instances... am i right?
@TheMacsupa
@TheMacsupa 8 жыл бұрын
As far as I know, no. Factory by its basic meaning, is singleton. But, unlike with services, you can use it by defining an instance of it (with the 'new' keyword) so it can be made just like as you stated.
@jamespilcher5287
@jamespilcher5287 7 жыл бұрын
i still dont see the distinction. surely you could use .service() and in the callback just set this=function () { return blah }, which makes .service() act like .factory()
@benphillips1
@benphillips1 9 жыл бұрын
Agreed, great video, but a giant heap of missing semicolons are crying out in agony.
@BinLiutrianglehomes
@BinLiutrianglehomes 8 жыл бұрын
i was about to ask, why there is no semicolons, is that OK?
@eBragaParah
@eBragaParah 8 жыл бұрын
+Bin Liu it's okay syntactically, but it's not seen as a good practice.
@MayankGupta303
@MayankGupta303 8 жыл бұрын
its a coding style. depends upon developers to developers
@wfpnknw32
@wfpnknw32 8 жыл бұрын
and the 'service' drinking game is born..
@pavel2747
@pavel2747 8 жыл бұрын
No need for 'new' keyword on lines 33,34 in the end. Great video anyway.
@daralhandasah8310
@daralhandasah8310 8 жыл бұрын
ya thats what i thought too
@TarekFaham
@TarekFaham 7 жыл бұрын
Why there is no need for 'new' keyword? Is this because the function is returned? In general, if this is defined using var myFactory = function () {...} then you need to use 'new', is my understanding correct?
@ehguacho2008
@ehguacho2008 9 жыл бұрын
i've heard you like service, so i put a service in your service so you can service while you service o.O
@compscilaw
@compscilaw 9 жыл бұрын
See those light yellow(I'm colourblind) boxes at the end of the } and other lines. That means you forgot a semicolon, you heathen! hahaha
@daveh.6098
@daveh.6098 8 жыл бұрын
thanks for it, but service service and factory service - was for me to much Service and factory should be enough. :)
@tickelmysoul
@tickelmysoul 8 жыл бұрын
David Hohl man, I couldn't stop laughing reading your comment. But his explanation is easy to understand
@AlexWohlbruck
@AlexWohlbruck 8 жыл бұрын
SEMICOLONS
@razvanmargineanu
@razvanmargineanu 8 жыл бұрын
GG
@ameyb88
@ameyb88 7 жыл бұрын
Waste of time.
Angular dependency injection in depth -  Dependency providers (2021)
17:19
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН
🎈🎈🎈😲 #tiktok #shorts
0:28
Byungari 병아리언니
Рет қаралды 4,5 МЛН
Service provider: useFactory | Angular Tutorial
9:33
WebGentle
Рет қаралды 4,5 М.
Dave Smith  - Deep Dive into Custom Directives - NG-Conf 2014
33:50
John Papa - 10 AngularJS Patterns - Code on the Beach 2014
1:01:27
Code on the Beach
Рет қаралды 83 М.
Angular Resource API - Everything You Have To Know (so far)
27:58
Decoded Frontend
Рет қаралды 18 М.
How AngularJs Works
19:27
mitchell marx
Рет қаралды 95 М.
Building Your First Angular HTTP Interceptor
6:24
Digital Fluency
Рет қаралды 13 М.
Learn and Understand AngularJS - The First 50 Minutes
49:41
Tony Alicea
Рет қаралды 750 М.