dimanche 10 mai 2015

Combobox value isn't captured using ng -model when inside a table generated by ng -repeat (AngularJS)

This is my code

<thead>
 <tr>
  <th>Id Detalle_Venta</th>
  <th>Id Producto</th>
  <th>Producto </th>
  <th>Cantidad </th>
  <th>Direccion </th>                            
  <th>Repartidor </th>                            
 </tr>
</thead>
<tbody>
  <tr ng-repeat="det in detalleVenta">
  <td>{{det.id_Detalle_Venta}}</td>
  <td>{{det.id_Producto}}</td>
  <td>{{det.nombre_Producto}} {{det.formato}}</td>
  <td>{{det.cantidad}}</td>
  <td>{{det.direccion}}</td>
  <td>
    <select name="test" class="form form-control" ng-model="comboRepartidor" ng-change="escogerRepartidor()">
     <option class="form form-control" id="idRepartidor" ng-repeat="rep in repartidores" value="{{rep.id_Repartidor}}">{{rep.nombre}}</option>
    </select>
  </td>
</tr>
</tbody>

The problem is in this lines:

    <select name="test" class="form form-control" ng-model="comboRepartidor" ng-change="escogerRepartidor()">
      <option class="form form-control" id="idRepartidor" ng-repeat="rep in repartidores" value="{{rep.id_Repartidor}}">{{rep.nombre}}</option>
    </select>

Angular doesn't capture the value of select with the ng -model="comboRepartidor". The event ng-change="escogerRepartidor() shoud be show de combo value but it show Undefined. If i move the combo out of the table works fine. What's the problem?

Aucun commentaire:

Enregistrer un commentaire