Javascript 在ng模型对象后添加新属性';已通过ng repeat更改
我想在ng repeat块中更改对象后,向ng模型对象添加一个属性“Discentrate” 选择一个选项后,ng模型将按预期更新。但“折扣”并不是作为一项财产添加的。显然,我遗漏了一些关于“范围”的东西。有人会研究这个问题吗?我怎样才能将“去中心化”属性添加到ng模型中Javascript 在ng模型对象后添加新属性';已通过ng repeat更改,javascript,angularjs,angularjs-scope,ng-repeat,Javascript,Angularjs,Angularjs Scope,Ng Repeat,我想在ng repeat块中更改对象后,向ng模型对象添加一个属性“Discentrate” 选择一个选项后,ng模型将按预期更新。但“折扣”并不是作为一项财产添加的。显然,我遗漏了一些关于“范围”的东西。有人会研究这个问题吗?我怎样才能将“去中心化”属性添加到ng模型中 <form class="form-horizontal" ng-submit="addToInvoice()"> <div class="form-group"> <
<form class="form-horizontal" ng-submit="addToInvoice()">
<div class="form-group">
<label for="inputService" class="col-sm-2 control-label">Service</label>
<div class="col-sm-4">
<select name="data.itemToSave" class="form-control" required="required"
ng-options="option.title for option in items.services track by option.id"
ng-model="data.itemToSave"></select>
</div>
</div>
<div class="form-group">
<label for="inputPrice" class="col-sm-2 control-label">Discount</label>
<div class="readonly" data-toggle="buttons">
<label class="btn btn-default" ng-class="{active: '!data.itemToSave.discountRate'}">
<input type="radio" ng-model="data.itemToSave['discountRate']" value="0">0%</label>
<label class="btn btn-default">
<input type="radio" ng-model="data.itemToSave['discountRate']" value="10">10%</label>
<label class="btn btn-default">
<input type="radio" ng-model="data.itemToSave['discountRate']" value="20">20%</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-4">
<button type="submit" class="btn btn-default">Add to Invoice</button>
</div>
</div>
</form>
服务
优惠
0%
10%
20%
添加到发票
删除数据切换=“按钮”
使其工作,无论是否使用ui.bootstrap
Its似乎与
ng repeat