ngModel does not display dynamic field value

1

In a function that includes dynamic fields, I am not able to display the value of the product when typed.

If I only do one input with normal value but with dynamic fields I can not see it, it follows the code:

$scope.somaOS = function(valor) {
  $scope.totalOS = parseFloat(valor);
};

$scope.inputs = [];
$scope.add = function(valor, desc) {
  var dataObj = {
    desc: desc,
    valor: valor
  };
  $scope.inputs.push(dataObj);
}
<div class="form-group col-md-4">
  <small class="d-block"><b>VALOR PRODUTOS</b></small>
  <span class="text-info font-weight-bold display-30">{{valor | currency}}</span>
</div>

<div id="produto" class="tab-pane">
  <div class="row">
    <div class="form-group col-md-2 mt-5 p-2">
      <button class="btn btn-info btn-sm" ng-click="add()"><i class="fa fa-plus"></i> Adicionar Campo</button>
    </div>
  </div>
  <div class="row">
    <div class="form-group col-md-6 input-group-sm">
      <label class="col-form-label">Descrição Produto</label>
      <div ng-repeat="input in inputs">
        <input class="form-control text-uppercase mb-1" ng-model="input.desc" name="upOSProd[]">
      </div>
    </div>
    <div class="form-group col-md-4 input-group-sm">
      <label class="col-form-label">Valor Produto</label>
      <div ng-repeat="input in inputs">
        <input class="form-control text-uppercase mb-1 input-group-sm" ng-model="input.valor" name="upOSProdValor[]" money-mask ng-keyup="somaOS(valor)">
      </div>
      {{valor}}
    </div>
  </div>
</div>

What can I be doing wrong?

    
asked by anonymous 11.10.2018 / 21:33

1 answer

0

I believe the error might be in these lines:

<input class="form-control text-uppercase mb-1 input-group-sm" ng-model="input.valor" name="upOSProdValor[]" money-mask ng-keyup="somaOS(valor)">

<input class="form-control text-uppercase mb-1" ng-model="input.desc" name="upOSProd[]">

You have tried to replace input.desc with inputs.desc or put the value in full ($ scope.inputs.desc)

    
11.10.2018 / 23:07