Gavin Wood
Gavin Wood

Reputation: 1006

multi if statment in my expression with shorthand if statment in angular

I have an expression that has three checks that need to be done.

so i was thinking of using it as follow:

{{payload.finance ==='value1' ? 'message 1'}}

but i need to do 3 checks so is there a way to do something like

{{payload.finance ==='value1' ? 'message 1' || payload.finance === 'value2' ? 'message 2' : 'message 2'}}

Upvotes: 0

Views: 17

Answers (1)

Barremian
Barremian

Reputation: 31105

You might be missing a colon in the first condition. Try the following

{{  payload.finance === 'value1' ? 'message 1' : payload.finance === 'value2' ? 'message 2' : 'message 3'}}

Upvotes: 1

Related Questions