What is the meaning of question mark in expressions in Angular 2?

Edit

Since the original answer, Ecmascript, and Typescript (in 3.7) have both added the ?. (called the optional chaining operator) operator. See the PR for details.

Original answer

This is not a Typescript operator. Angular 2 has a safe navigation operator in templates.

values?.listArray

is equivalent to

values != null ? values.listArray: null

More info here and here

Leave a Comment