When generating services in the Angular CLI, it is adding extra metadata with a ‘provided in’ property with a default of ‘root’ for the Injectable decorator.
@Injectable({
providedIn: 'root',
})
What exactly does providedIn do? I am assuming this is making the service available like a ‘global’ type singleton service for the whole application, however, wouldn’t be cleaner to declare such services in the provider array of the AppModule?