Simplifying Different Types of Providers in Angular

An Angular Service provider delivers a runtime version of a dependency value. Therefore, when you inject a service, the Angular injector looks at the providers to create the instance of the service. It is the provider that determines which instance or value should be injected at the runtime in components, pipes, or directives. There is a lot of jargon involved here, so to understand the purpose of the types of providers, let us start with creating a service. Let’s say we have a service calledĀ ErrorService, which is just logging the error message.
import { Injectable } from ‘@angular/core’;

export class ErrorService {

logError(message: string) {