To start using DI in our applications, we will need to understand the concept of Providers. Providers configuration in the component decorator tells Angular which classes need to be provided to the component.
In the provider configuration, DI takes an array of all the classes i.e injection tokens, we want to provide to the component. We can also specify the class using useClass to instantiate for the registered token.
Take a quick look at the syntax for using the providers configuration:
@Component({ templateUrl: './calculate-tax.component.html', styleUrls: ['./calculate-tax.component.css'], providers: [MyTax]})
In the preceding code, we are telling Angular that the preceding component needs to be provided ...