Select component with ng-model, relationship between tables

Asked

Viewed 194 times

1

I have a select component

<div  class="form-group col-md-4">
        <label>Município:</label> 
        <select ng-model="distrito.entidade.id.municipio.id.nome"  class="form-control"  >
            <option value="{{mun.id}}"  ng-repeat="mun in municipios " >{{mun.nome}}</option>   
        </select>
</div>

and I want to bring the name of the municipality that is within the municipality table this within the entity table that is related to the district table where is the component.

PS: The information is coming correctly from the on-screen controller.js because it has been debugged.

1 answer

0


I managed to solve by changing the value and the ng-repeat

<div class="form-group col-md-4">
    <label>Município:</label>
        <select ng-model="distrito.entidade.municipio.id" class="form-control">
            <option value="{{dis.idEntidade.idMunicipio.id}}" ng-repeat="dis in distritos">{{dis.idEntidade.idMunicipio.nome}}</option>
        </select>
</div>

Browser other questions tagged

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