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 (213) [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.