You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Services don't relate to one View, they relate to a service or set of actions that they help provide for an app. So your scenario is quite common. You're already more than half way there :)
First we decide if we have the need for a service. You already did that with determining it handles state.
Then we decide how to extract ust that logic. You did that too!
Then we decide who needs it. Is it used by 1 controller? 1 service? 1 directive? Are they all in 1 feature/module? If used by one module I put it in that module. If used across the app, put it in a shared module.
For example: I have a StatesService. It returns all states of a country, but It doesn't have its own view.
In "Folder-by-feature" https://github.com/johnpapa/angular-styleguide/tree/master/a1#folders-by-feature-structure, It can see a 'services' folder, but not in image below.
For moment, I'm using an "extra" folder to put services with no controllers nor views.
@johnpapa
The text was updated successfully, but these errors were encountered: