What is the provider in Angular?
In Angular dependency, injection is used to inject the dependencies of services. A Provider works as an instructor for the dependency injection system to resolve the dependencies. When you create any service, it comes with default @Injectable decorator that contains a default property 'providedIn,' which establishes the provider for service.
BY Best Interview Question ON 29 May 2020
Example
@Injectable({
providedIn: 'root',
})
export class DataService {
}
You can inject the services in the root or particular module as well, and you can limit the scope of service to a particular component by using component providers.
@Component({
providers: [DataService]
})