I wanted to add a property "discountRate" to ng-model object after the object is changed within a ng-repeat block.
After selecting an option the ng-model is updated as expected. But the "discountRate" is not added as a property. Appearantly I am missing something about "scope". Would someone look into this, how can I have "discountRate" property be added to ng-model?
<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>
Removing data-toggle="buttons"
makes it working, with or without ui.bootstrap
ng-change,ng-click don't work with data-toggle="buttons" since v1.3.0