Reputation: 151
Actually, I have two questions about angular 4 best practice.
RemoteService
, which is responsible for XHR calls. I want to catch component instance, which is using that service, in RemoteService
. So I guess, it is better to provide that service per component level. Because I don't want every methods of the service take component instance by parameter. But, is it good or bad to provide service per component?. By the way: RemoteService
will be used in hundreds of components.RemoteService
?. Shared feature module or Core feature module?. It's purpose seems like ExceptionService
and LoggerService
. But it is not singleton service as I explained above. It may depends on answer of question 1.Upvotes: 0
Views: 2436
Reputation: 3967
So to answer both your questions - a RemoteService
is definitely a good idea. I usually call mine ApiService
.
This is a good idea for several reasons -
In terms of where to put it - John Papa's style guide suggests putting this file in the shared
folder: https://johnpapa.net/angular-2-styles/
Upvotes: 2