Suggest an editImprove this articleRefine the answer for “How does the safe navigation operator (?.) work in a template?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**The safe navigation operator (`?.`)** in Angular is used in a template to safely access properties of objects that may be `null` or `undefined`, to avoid runtime errors. **Key point:** `?.` is a guard for the template against errors when accessing potentially missing objects or properties.Shown above the full answer for quick recall.Answer (EN)ImageIn Angular, the **safe navigation operator (**`?.`**)** is used in a template to **safely access properties of objects that may be** `null` **or** `undefined`, to avoid runtime errors. ## Main points 1. **Syntax**: ```html <p>{{ user?.name }}</p> ``` - If `user` is not `null` and not `undefined`, `user.name` is displayed. - If `user` equals `null` or `undefined`, Angular simply outputs an empty string instead of an error. 2. **Can be used to call methods**: ```html <p>{{ user?.getFullName() }}</p> ``` - The method is called only if `user` exists. 3. **Applied with a chain of objects**: ```html <p>{{ user?.address?.city }}</p> ``` - Safely checks each level of nesting, preventing errors like "Cannot read property 'city' of undefined". In other words, `?.` is **a guard for the template against errors when accessing potentially missing objects or properties**.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.