Tomas Trajan
1 min readDec 27, 2018

--

Hi Hugo Noro!

They way I understood your response is that you have {auth,login,register}.module.ts and that the auth is kinda their parent and it is lazy loaded and so they are all lazy loaded and that you also have AuthSharedModule and you would like to share service only within this lazy loaded piece of functionality. Is this correct?

If so then yeah providedIn: 'root' would make your service available in the whole app and I also see a value in preventing that from happening.

You could go with the solution you proposed in your response or with the providedIn: SharedAuthServiceModule (to prevent circular deps) but I guess standard ( old / your ) solution is simpler and therefore better.

Cheers!

--

--

Tomas Trajan
Tomas Trajan

Written by Tomas Trajan

👋 I build, teach, write & speak about #Angular & #NgRx for enterprises 👨‍💻 Google Developer Expert #GDE 👨‍🏫 @AngularZurich meetup co-organizer

No responses yet