convert 1 to active and 0 inactive within ng-repeat angular

3

I have a flag value that is 1 for active and 0 for inactive within a ng-repeat that I display in a table, however I need this value to be Active if 1 and inactive if 0

           <tbody ng-repeat="oper in operadorasCartoes" >
                <tr>
                  <td>{{oper.nome}}</td>                   
                   <td>{{oper.cnpj}}</td>
                   <td>{{oper.flagAtivo}}</td>                    
                </tr>               
              </tbody> 

Can you do it by html?

    
asked by anonymous 18.05.2018 / 14:58

1 answer

3

One option is to use a ternary operator:

<tbody ng-repeat="oper in operadorasCartoes" >
  <tr>
    <td>{{oper.nome}}</td>
    <td>{{oper.cnpj}}</td>
    <td>{{oper.flagAtivo === 1 ? 'Ativo' : 'Inativo'}}</td>
  </tr>
</tbody>
    
18.05.2018 / 15:04