These are chat archives for angular/angular.js

29th
Jan 2017
Kyse
@kyse
Jan 29 2017 01:30
Hey guys, had a question regarding angular and more specifically documentation. I was noticing ngdocs only has provider and service ngdoc types, but nothing for factory. I was curious why this is, and noticed there isn't really any uses of using the angular factory framework explicitly. All I see are implicit factories created manually via provider. Am I misunderstanding something here, or would it make sense to add a factory parser to my documentation generation for my own source code or should I just be creating doc tags for provider and service above the factory I define? I feel like that could/would confuse some new guy coming onto the project and running through the documentation to get up to speed if they haven't messed with angular much before.
Donno why I said 'had', not past tense is it, still have the question. :P
Travis
@TravisHi
Jan 29 2017 07:26
Hello?
George Kalpakas
@gkalpak
Jan 29 2017 09:05

@TravisHi: Hi
@kyse: The are only providers and services in AngularJS. For registering providers (that provide services), you use the .provider() method. When you don't need to explicitly define a provider and just want to register a service, there other higher-level helpers you can use (which are essentially syntactic sugar over .provider()): .factory(), .service(), .value()

So ragardless of what method you use, you will end up with a provider (which might be automatically created under the hood) and a service.
It is just unfortunate (and a common source of confusion) that one of the helper methods is also called service :(

Note that according to the Dev Guide:

AngularJS services are substitutable objects that are wired together using dependency injection (DI).

So, each method (provider, factory, service, value) defines a "recipe" for creating such a "substitutable object", but in the end you always end up with an object.
(Keep in mind that in JavaScript functions are objects too :wink:)
Frederik Prijck
@frederikprijck
Jan 29 2017 10:44
It is just unfortunate (and a common source of confusion) that one of the helper methods is also called service
@gkalpak did you see shai reznik's ng-what ? :D
George Kalpakas
@gkalpak
Jan 29 2017 10:52
Who hasn't?
Frederik Prijck
@frederikprijck
Jan 29 2017 10:52
i only found him a few weeks ago :(
But saying that remind me of his "filter filter" part etc :D
George Kalpakas
@gkalpak
Jan 29 2017 10:57
Shai's talks are a must-see :smiley:
(Although that first ng-conf talk is still the best imo.)
Frederik Prijck
@frederikprijck
Jan 29 2017 11:03
Isn't that the one called ngwhat?
George Kalpakas
@gkalpak
Jan 29 2017 11:27
Yup
Faddah Wolf
@faddah
Jan 29 2017 14:49
just wanted to stick my head in and say a 'Hello World!' to all, from portland, oregon, u.s.a.
George Kalpakas
@gkalpak
Jan 29 2017 17:02
Hi
Robert
@robert197
Jan 29 2017 22:16
hi, anyone here knows how to solve this problem?: i have built a directive which is a wrapper of other directive… now i have to always change an attribute of this child directive depending on data was given. so i think this process should happen before child directive is rendered.