In Angular, there is the support elvis operator ?.
to protect against a view render failure. They call it the safe navigation operator. Take the example below:
The current person name is {{nullObject?.name}}
Since it is trying to access name property of a null
value, the whole view disappears and you can see the error inside the browser console. It works perfectly with long property paths such as a?.b?.c?.d
. So I recommend you to use it everytime you need to access a property inside a template.