Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular styleguide #15

Closed
verebelyin opened this issue Oct 17, 2017 · 2 comments
Closed

Angular styleguide #15

verebelyin opened this issue Oct 17, 2017 · 2 comments

Comments

@verebelyin
Copy link

verebelyin commented Oct 17, 2017

Hi!

I bumped into this project while I was looking for an example app that is following the official Angular styleguide.

I see that you are trying to follow the guidelines, but there is one thing, which is against it. Specifically against this point:
Avoid providing services in shared modules. Services are usually singletons that are provided once for the entire application or in a particular feature module.

Is it intentional that you have the src/app/shared/services/ folder, and services in it, which are used throughout the app?

According to the Angular styleguide, it should be placed under src/app/core.

Thanks,
Norbert

@Ismaestro
Copy link
Owner

Ismaestro commented Oct 18, 2017

Hi @verebelyin!

You are completely right, so I've made some changes.

You can see them here.

Now, there is no 'shared service' but in some cases we could need one. I think this solution could be nice.

Tell me what you think.

Thanks and best regards.

@verebelyin
Copy link
Author

Thank you for the modification, now it seems better :)

Yes, I agree, that in some cases it's needed, but it will be usually coming from one of the components.

In this example, it's the HeroService, that is placed in the app/heroes/shared, indicating it's a shared service, but belongs to the Hero component. And it is imported in the SharedModule as a global provider, to make it available for everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants