简体   繁体   English

AngularJS形式的未定义对象

[英]undefined object of AngularJS form

I need to enter all the variables of a ng-repeat, now I run into a problem when I enter these variables there are two variables as undefined, and they are not different from the rest, because this happens, the variables are "pies_tablares" and "observacion": 我需要输入一个ng-repeat的所有变量,现在我遇到了一个问题,当我输入这些变量时,有两个未定义的变量,它们与其余变量没有区别,因为发生这种情况,这些变量是“ pies_tablares”和“观察”:

<tr ng-repeat="table in datos">
    <td>
        <input type="text" class="form-control" ng-model="especie" ng-value="table.especie" readonly>
    </td>
    <td>
        <input type="text" class="form-control" ng-model="largo" ng-value="table.largo" readonly>
    </td>
    <td>
        <input type="text" class="form-control" ng-model="ancho" ng-value="table.ancho" readonly>
    </td>
    <td>
        <input type="text" class="form-control" ng-model="espesor" ng-value="table.espesor" readonly>
    </td>
    <td>
        <input type="text" class="form-control" ng-model="cantidad" ng-value="table.cantidad" readonly>
    </td>
    <td>
        <input type="text" class="form-control" ng-model="pies_tablares" ng-value="table.pt" readonly>
    </td>
    <td>
        <input type="text" class="form-control" ng-model="observacion">
    </td>
</tr>

Here always are undefined: 这里始终是未定义的:

angular.forEach($scope.datos, function(obj)
{
dataConcilation = {
    especie: obj.especie,
    largo: obj.largo,
    ancho: obj.ancho,
    espesor: obj.espesor,
    cantidad: obj.cantidad,
    pies_tablares: obj.pies_tablares,//undefined
    observacion: obj.observacion, //undefined
    purchase_order_id: idPurchaseConcilation,
    fecha_conciliacion: moment().format('YYYY-MM-DD hh:mm:ss')
};

How can i fix this? 我怎样才能解决这个问题?

not sure i get what you exactly want but why not try to put the ng-value for these variables ? 不知道我能得到您真正想要的东西,但是为什么不尝试为这些变量输入ng值呢?

<td>
   <input type="text" class="form-control" ng-model="pies_tablares" ng-value="table.pies_tablares" readonly>
</td>
<td>
   <input type="text" class="form-control" ng-model="observacion" ng-value="table.observacion" readonly>
</td>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM