Using ng-style for a boolean variable inside an ng-repeat Angularjs

Asked

Viewed 109 times

0

I have a listing this way :

<tr md-row md-select="cali" md-select-id="name" md-auto-select ng-repeat="cali in vm.calibracoes">
           <td md-cell>{{cali.idCalibracao}}</td>
           <td md-cell>{{cali.pessoa.nome}}</td>
           <td md-cell >{{cali.ativa? 'Sim' : 'Não'}}</td>
           <td md-cell>{{cali.dataCalibracao | date:'dd/MM/yyyy'}}</td>
           <td md-cell>{{cali.dataProximaCalibracao | date:'dd/MM/yyyy' }}</td>
           <td md-cell>

        </td>
 </tr> 

How do I leave the 'Yes' in blue and the 'No' in red ? Using ng-style or ng-class ? I have never used these resources from Angularjs

1 answer

0


I was able to solve it this way:

 <td md-cell ng-style="{ 'color' : (cali.ativa) ? 'blue' : 'red' }">{{cali.ativa? 'Sim' : 'Não'}}</td>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.