So I have a ternary operator test in my angularJS code to determinate which variable to use on a repeat block, but this test is being done many times inside it and I think this is dumb. Is there a way to store the expression result in a variable and use it instead of repeating the expression?
The code:
<tr ng-repeat="meta in metas">
<td class="mdl-data-table__cell--non-numeric">
{{meta.admMetNome}} <span class="pull-right">{{meta.pagCidadesPagCid[0].pagCidId ? usuarios[meta.pagCidadesPagCid[0].pagCidId].qtd : usuarios['total'].qtd}} / {{meta.admMetValor}}</span>
<md-progress-linear md-mode="determinate" value="{{(meta.pagCidadesPagCid[0].pagCidId ? usuarios[meta.pagCidadesPagCid[0].pagCidId].qtd : usuarios['total'].qtd) * 100 / meta.admMetValor}}"></md-progress-linear>
{{(meta.pagCidadesPagCid[0].pagCidId ? usuarios[meta.pagCidadesPagCid[0].pagCidId].qtd : usuarios['total'].qtd) * 100 / meta.admMetValor | number:2}}% - Prazo: de {{meta.admMetInicio | date: 'dd/MM/yyyy'}} a {{meta.admMetFim | date: 'dd/MM/yyyy'}}
</td>
</tr>