I want to create NewService
. And I want to have possibility to call it from all application?
Where I should inject it in SharedModule (module which exports all reusable modules) or in AppModule ( main module of my application)
@NgModule({
providers: [
// Here?
]
})
It doesn't matter if you add it to the AppModule
directly or to a feature module as long as the module is not lazy loaded.
Lazy loaded modules have their own root scope and providers added there are only visible to the lazy loaded module.