Subhadeep
Subhadeep

Reputation: 257

what is a provider in angular 2+

So in this topic , i got some answer but i wanted to understand what providers are and how its related to service injection(DI)

my understanding:

provider in angular is "matadata" about the component or module (provider array), which is responsible for attaching a particular service to particular injector(component level or module level) . Is that correct?

Provider always refers to provider array we declare in component or module? How you guys will explain provider to a layperson?

Upvotes: 0

Views: 71

Answers (1)

Gurvinder Guraya
Gurvinder Guraya

Reputation: 669

Basically providers in angular is just a instruction for the Dependency Injection system on how to obtain a value for a dependency you want to inject.

For more Info you can refer to angular documentation

https://angular.io/guide/providers

https://angular.io/guide/dependency-injection-pattern

Upvotes: 1

Related Questions