The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

vkelman (54) [Avatar] Offline
#1
In Angular 6 it now doesn't add provider to app.module, but instead generates product.service.ts with

@Injectable({
  providedIn: 'root'
})


which, according to https://blog.ninja-squad.com/2018/05/04/what-is-new-angular-6/ allows to load service lazily. It looks like "-m" option is ignored now.

What is not clear to me: now by looking at app.module we cannot determine which providers does it use. Isn't it making code much harder to understand?
Yakov Fain (219) [Avatar] Offline
#2
I'm not sure if the provideIn property is that useful. It spares you from mentioning the services in the root module, but it's not clear what to do if you want to change the provider or if you want to declare a provider on the component level. For not, I don't use this provideIn property.