0

Below code is not working I want to check for below conditions

  • event.format === 'Online' then style red color

  • event.format === 'InPerson' then style green color

  • if neither InPerson nor Online then style #aaa color

I tried

 [ngStyle]="{'color': event?.format=== 'InPerson' ? 'green' : (event.format==='Online ? 'red':'#aaa')}"
harish kumar
  • 1,732
  • 1
  • 10
  • 21
  • You're missing a quotation after `'Online`. It should be `'Online'`. Is the error or is it a typo here? – ruth Jun 17 '20 at 09:59
  • the code is below that statement – Divya Sehgal Jun 17 '20 at 10:00
  • Yes I formatted the code to be read easily but you reverted the edit. And it's a 'yes' or 'no' question. You're missing a quotation mark after the string literal `Online`. Please read your code once more carefully before answering. – ruth Jun 17 '20 at 10:02
  • Can you try `[ngStyle]="{'color': event.format === 'InPerson' ? 'green' : (event.format === 'Online' ? 'red' : '#aaa' )}"` – harish kumar Jun 17 '20 at 10:08

0 Answers0