Answers for "conditional style angular"

5

conditional style angular

<div [ngStyle]="{'color':employee.country === 'India' ? 'orange' : 'red' }"></<div>
Posted by: Guest on October-18-2020
1

conditional inline style angular

// ngStyle (conditional Style)
<div *ngFor='let [data] of [dataArray]; let i=index;'>
  <h2 [style.background]="i>1? 'green': 'red'"> {{i}} {{data.title}} </h2>

  </div> 

//if the index of the element is 1 or 0, the background will be red, if it is over 1 the background will be green
Posted by: Guest on October-12-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language