Angular · Junior · Question 17 of 75

Which Angular feature makes {{ user?.address?.city }} safe when user is null?

Explanation

Templates support optional chaining and nullish coalescing (??) like TypeScript. With strictTemplates the compiler also warns when you access a property of a possibly null value.

Further reading

Problem with a question

Angular · Junior · question 17

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