角。如何将多行表中的所有行传递给表单?表格位于

时间:2015-07-03 17:12:26

标签: javascript html angularjs angularjs-ng-repeat

我正在尝试将所有行注册到我的表单中。

整个我的代码

<form name="form" novalidate  ng-cloak="" ng-submit="save()">
        <table cws-table="cwsitem" table-data="primaryProxies" table-filter='{name: filterProxy}'  table-info="settings.tableInfo"
               track-by="cwsitem.name" displayed-items="listProxies.displayedItems"
               cws-checkbox-selector
           styles="cwstable cwstable-striped cwstable-hover cwstable-bordered cwstable-block-responsive">
        <thead>
            <tr>
                <th cws-table-header column="select" class="col-sm-1"  cws-show="! settings.readOnly" >
                    {{data.totalSelected}}<button cws-show='showUpdateStatus(cwsitem.defaultSuperUser)'
                            cws-checkbox-all cws-checkbox-all-list="primaryProxies" cws-checkbox-displayed-items="listProxies.displayedItems"
                            cws-checkbox-displayed-selected="listProxies.displayedSelected" cws-checkbox-total-selected="listProxies.totalSelected"
                        cws-checkbox-all-display="showCheckbox"></button>
                </th>
                <th cws-table-header column="name" sortable='true' class=""><span ng-i18next="itr.table.primary_proxy"/></th>
                <th cws-table-header column="backupName" sortable='true' class=""><span ng-i18next="itr.table.backup_proxy"/></th>
            </tr>
        </thead>
        <tbody>
            <tr cws-table-body ng-class="{info: cwsitem.selected, success: cwsitem.createdProxy }">
                <td cws-show="! settings.readOnly" id="select{{$index}}">
                    <button cws-checkbox cws-checkbox-id="cwsitem" cws-checkbox-selected="cwsitem.selected" cws-checkbox-display='showUpdateStatus(cwsitem.defaultSuperUser)'></button>
                </td>
                <td>
                    <div
                          class="form-group "
                          cws-error
                          cws-validation
                          cws-validation-strategy
                          form = "form"
                          validation-strategy-object = "proxyValidation.updateProxyValidation"
                          back-end-errors = "backEndErrors"
                          input-name = "backupProxyname"
                          input-label = "inputBackupProxy"
                          validation-form-submit = "validTrigUpdateProxy">
                        <input class="field floatnone form-control width-output-proxy" 
                             type="text" 
                             size="3" 
                             maxlength="60" 
                             ng-model="cwsitem.name"
                             id="primary_{{$index}}"
                             name="cwsitem.sequenceNumber">
                        <p cws-error-message errors="errorMessages" class="width-error-proxy"/>
                    </div>
                </td>
            </tr>
          </tbody>
        </table>

    </form>

另一方面,我有一项服务,我必须在此表单中为验证输入编写一些策略。输入具有ng-model = cwsitem.name。这并不意味着每行都有相同的数据。我有一个对象数组,其中每个对象都有属性“name”。

[{ “名称”: “proxy43.scansafe.net”, “端口”:8080, “backupName”: “proxy48.scansafe.net”, “backupPort”:8080},                                                    { “名”: “proxy137.scansafe.net”, “端口”:8080, “backupName”: “”, “backupPort”: “”},                                                    { “名”: “proxy24.scansafe.net”, “端口”:8080, “backupName”: “”, “backupPort”:8080},                                                    { “名称”: “proxy787.scansafe.net”, “端口”:8080, “backupName”: “”, “backupPort”: “”}]

新行获取此列表的新对象。 不幸的是,当我点击按钮并将此表单传递给服务时,我可以看到我的表单只保留最后一行并且调用我的策略与行数相同的数量。我需要我的表格来保存我的所有行。

0 个答案:

没有答案