我有5个固定的Textbox,我有一个JSON数组,它应该与Textbox绑定。第0个索引元素将与第1个文本框绑定。
<input type="text" class="form-control col-md-5" ng-model="jsonArray[0].amount">
我需要在 ng-model 中添加什么?
jsonArray中的有5个Json对象,但文本框中不会显示任何内容。
答案 0 :(得分:3)
在控制器中,您可以为变量分配并绑定它,
<强>控制器强>
$scope.amount = jsonArray[0].amount;
<强> HTML 强>
<input type="text" class="form-control col-md-5" ng-model="amount">