Angular · Senior · Question 20 of 75

What is the difference between providers and viewProviders in a component?

Explanation

Use viewProviders to keep an internal service private, so components passed in through <ng-content> by the parent can't accidentally inject it.

Further reading

Problem with a question

Angular · Senior · question 20

Test yourself

Take the Angular · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz