Problem with select using ng-repeat

Asked

Viewed 23 times

-1

I’m mounting a select with the data coming from my base.

What happens: Depending on the < option > I select, the field removes all others.

Select populated:

inserir a descrição da imagem aqui

After selecting some option:

inserir a descrição da imagem aqui

<select ng-model="usuarios" class="form-control">
                 <option disabled ng-selected="true">Todos</option>
                 <option ng-repeat="user in usuarios" value="{{user.id}}">{{user.nomeCompleto}}</option>
             </select>
  • 1

    Just one story: here in the community they started to deny any question, without at least checking the content of the question.

1 answer

2


Your code is missing in the ng-model of <select>, you are modeling the variable usuarios which is the same variable that contains array of users used in <option ng-repeat="user in usuarios">.

Set a new name for the users variable in your ng-model that will be all right. Ex: <select ng-model="usuarioSelecionado">.

Browser other questions tagged

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