【发布时间】:2017-08-25 11:46:58
【问题描述】:
点击后,我不想在我选择了数字的输入中显示 console.log $scope.value。
我的代码:
<table class="table table-bordered table-striped">
<thead>
<tr>
<th >Name
<th >System
</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="n in data">
<td style ="word-break:break-all;">{{n.name}}</td>
<td style="width:35px;">{{n.system}}</td>
<td><input class="form-control input-sm" type="number" name="input" ng-model="value"
min="0" max="100" style="width:55px;">
</td>
</tr>
</tbody>
</table>
<button ng-click="postapi()">Value</button>
Plunker:http://plnkr.co/edit/g1t4pludTTIAJYKTToCK?p=preview
提前感谢您的回答!
【问题讨论】:
-
为什么要将数据中的所有元素绑定到
value,而不是将每个元素绑定到它自己的值,例如ng-model="n.value",而不是ng-model="value"?使用您的方法,您将对data中的所有项目具有相同的价值
标签: javascript angularjs