Angular · Senior · Question 16 of 75

In which order does Angular resolve inject(Token) in a component?

Explanation

The nearest provider wins, which is how a component can override a root service for its subtree. If nothing is found, NullInjector throws unless the injection is optional.

Further reading

Problem with a question

Angular · Senior · question 16

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