Finally after watching your video I understand the difference. Thanks!
@Akshay-nl2cy8 жыл бұрын
Finally after a long struggle to get the concept,understood clearly here...very much thank u sir...
@Swanidhi9 жыл бұрын
Service service does the service but the service factory service doesn't, so service service service service! :P Subscribed!
@PieEatinSuicideGrunt9 жыл бұрын
+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).
@toby1kenobe8 жыл бұрын
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.
@UBOATss9 жыл бұрын
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.
@humaripragati7 жыл бұрын
What a super video. I have went through many blogs but my search ended here for this
@AIWorkflows9 жыл бұрын
I have really been wondering about this, great video.
@alejandrov4449 жыл бұрын
btw, what do you use to record your videos?
@mahakjain41217 жыл бұрын
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?
@yeshwanthchowdary8 жыл бұрын
Perfect example. Thank you
@stefaniehall53418 жыл бұрын
Wonderfully simple. Thank you.
@20Raghu9 жыл бұрын
Great video.And what is the IDE that you are using?
@SarathKumars9 жыл бұрын
+Raghu webstorm
@stephanecastellani21408 жыл бұрын
Excellent explanation, thanks
@BrianGentles9 жыл бұрын
Great video but where have all the semi-colons gone
@Mateush539 жыл бұрын
+Brian Gentles JS have feature called automatic semicolon insertion, therefor semicolons are optional.
@denicho23978 жыл бұрын
What text editor is this?
@BinLiutrianglehomes8 жыл бұрын
great tutorial!!! Thank you!
@MikeMonji8 жыл бұрын
What did semicolons ever do to you?
@mahluleligoodson8 жыл бұрын
The whole tutorial felt like a decade because of that #lol
@Patrk387 жыл бұрын
semicolons are useless in JS
@Skaxarrat7 жыл бұрын
Semicolons are // Not implemented
@Wolinho9 жыл бұрын
Perfectly explained - thank you!
@terrellisaias42793 жыл бұрын
i realize Im pretty randomly asking but does anyone know of a good site to stream new movies online ?
@felixjoseph88153 жыл бұрын
@Terrell Isaias Meh lately I've been using Flixportal. just search on google for it:P -felix
@terrellisaias42793 жыл бұрын
@Felix Joseph thank you, I signed up and it seems like a nice service =) I appreciate it !!
@felixjoseph88153 жыл бұрын
@Terrell Isaias No problem :D
@ShaikhAhmedReza7866 жыл бұрын
well explained
@Lina-mb3vt8 жыл бұрын
thanks for the video, that was really helpful :)
@alejandrov4449 жыл бұрын
Greaaaaaaat video! Thanks
@vibhatha8 жыл бұрын
Awesome and really cool :)
@stanislautsishkou56328 жыл бұрын
much clear, thx
8 жыл бұрын
So... Angular services are singletons, and factories are multi instances... am i right?
@TheMacsupa8 жыл бұрын
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.
@jamespilcher52877 жыл бұрын
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()
@benphillips19 жыл бұрын
Agreed, great video, but a giant heap of missing semicolons are crying out in agony.
@BinLiutrianglehomes8 жыл бұрын
i was about to ask, why there is no semicolons, is that OK?
@eBragaParah8 жыл бұрын
+Bin Liu it's okay syntactically, but it's not seen as a good practice.
@MayankGupta3038 жыл бұрын
its a coding style. depends upon developers to developers
@wfpnknw328 жыл бұрын
and the 'service' drinking game is born..
@pavel27478 жыл бұрын
No need for 'new' keyword on lines 33,34 in the end. Great video anyway.
@daralhandasah83108 жыл бұрын
ya thats what i thought too
@TarekFaham7 жыл бұрын
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?
@ehguacho20089 жыл бұрын
i've heard you like service, so i put a service in your service so you can service while you service o.O
@compscilaw9 жыл бұрын
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.60988 жыл бұрын
thanks for it, but service service and factory service - was for me to much Service and factory should be enough. :)
@tickelmysoul8 жыл бұрын
David Hohl man, I couldn't stop laughing reading your comment. But his explanation is easy to understand