Reputation: 2116
I am trying to bind a 0 to my html template if there is no value present from an endpoint. So I have the below in my HTML
${{ amount }}
If amount is not available I would like to show $0
to the user. Is this possible to do in the HTML template or do I have to do a check in my TS file?
Upvotes: 0
Views: 483
Reputation: 31105
Angular template interpolations are Typescript expressions. So you could use the ||
operator
${{ amount || 0 }}
Upvotes: 4