Angular · Junior · Question 31 of 75

Where can inject() be called?

Explanation

Calling inject() in an event handler throws NG0203. Inject dependencies once at construction and use them later in methods.

Further reading

Problem with a question

Angular · Junior · question 31

Test yourself

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

Take this quiz