angularjs - 模型更改时更新表列

时间:2014-11-25 18:17:23

标签: javascript angularjs angularjs-ng-repeat angular-ngmodel

我有一个基于我的控制器模型动态定义的dataTable,如下所示:

<tbody>
    <tr ng-repeat="rec in grid.records">
        <td ng-repeat="col in grid.columns" 
            ng-init="value=rec[col.name]">
            <span ng-model="rec[col.name]">{{value}}</span>
        </td>
    </tr>
</tbody>

为什么在模型更改时不更新dataTable列值?

1 个答案:

答案 0 :(得分:1)

试试这个:

<tbody>
    <tr ng-repeat="rec in grid.records">
        <td ng-repeat="col in grid.columns">
            <span>{{rec[col.name]}}</span>
        </td>
    </tr>
</tbody>