Why, at Angular, do we use interrogation?

Asked

Viewed 466 times

5

Because in Angular we use interrogation, for example:

*ngIf="listaxpto?.clientes.length"

1 answer

14


The ? is a operator Angular protecting property against null and undefined values.

In your case, without the use of the operator and the object listaxpto being null would be released an exception

Typeerror: Cannot read Property 'clients' of null.

but in some cases it is necessary to start the property with value null

Browser other questions tagged

You are not signed in. Login or sign up in order to post.