0
I need to change the color of the student status on the page, and wanted to do this using the angled, can someone help me how I do this using the value of the element?
HTML:
<tbody>
<tr ng-repeat="item in filtered = (filterList | filter: {cod_bolsa : clientSearch || undefined}: true) | start: (currentPage - 1) * maxPerPage | limitTo: maxPerPage">
<td>{{item.nome_aluno | uppercase }}</td>
<td ng-class="{'green': item.status_aluno == 'Ativo' , 'red': item.status_aluno == 'Cancelado' , 'orange': item.status_aluno == 'Substituído'}">{{item.status_aluno}}</td>
<td>{{item.nome_orientador}}</td>
<td>{{item.nome_coorientador}}</td>
<td>{{item.departamento}}</td>
<td>{{item.numero_edital}}</td>
<td>{{item.tipo_bolsa | uppercase }}</td>
</tr>
</tbody>
CSS:
.red{
color: red;
}
.green {
color: green;
}
.orange{
color: orange;
}
I used the tip given at stackoverflow gringo: https://stackoverflow.com/questions/30243965/change-the-font-color-based-on-value-angular-js but it’s not working.
What version of Angular are you using? Because the question quoted is old and why it does not work.
– NoobSaibot
version 1.6.4, downloaded via npm https://registry.npmjs.org/angular/-/angular-1.6.4.tgz
– Gabriel Becher
Alter:
ng-class="'red': item.status_aluno === 'Ativo'"
forng-class="{'red': item.status_aluno === 'Ativo'}"
... Documentation– NoobSaibot
Functionouuu, thanks it worked ;)
– Gabriel Becher
do you have any idea how I do for more than one value?
– Gabriel Becher
is just picking up the green no matter what value I enter in the status table cell
– Gabriel Becher
found an answer in the gringo stack, valeuu https://stackoverflow.com/questions/18172573/angular-ng-class-if-else-expression
– Gabriel Becher