Error while listing data in Angularjs

Asked

Viewed 28 times

0

Hello! I am listing data and at the same time is pointing me error, but I do not know how to correct. inserir a descrição da imagem aqui

The data being listed comes like this: inserir a descrição da imagem aqui

Follows my code

<div id="inputGrupo">
    <select class="form-control contaGrupo" name="categoria" id="" ng-model="conta.grupo" required>
        <option value="">Selecione o grupo...</option>
        <option ng-repeat="g in grupos" value="{{ g.idgrupo }}">{{ g.grupo }}</option>
    </select>
</div>

How to correct this error?

1 answer

0

The error message is clear, you have duplicate keys in the array, always good to set the track by no ng-repeat in the example you placed would:

<div id="inputGrupo">
   <select class="form-control contaGrupo" name="categoria" id="" ng-model="conta.grupo" required>
      <option value="">Selecione o grupo...</option>
      <option ng-repeat="g in grupos track by g.idcategoria" value="{{ g.idgrupo }}">{{ g.grupo }}</option>
   </select>
</div>
  • I’ll try again, but I’ve tried to do what you suggested I haven’t changed kkk

  • In the latter case try to define ng-repeat="(key, g) in groups track by key"

Browser other questions tagged

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