Ismaestro / angular-example-app

Angular 17 Example App + Standalone Components + i18n + EsBuild

Home Page:https://angular-example-app.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular styleguide

verebelyin opened this issue · comments

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

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.

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.