Trying to add an ng-model value to an array inside an ng-controller using the input box.
It appears that when checking the box, the ng-model property changes:
Encountering a Problem
https://i.sstatic.net/TU0xh.jpg
https://i.sstatic.net/1qqWu.jpg
https://i.sstatic.net/W8WOc.jpg
I want the ng-model property to remain unchanged when the input is checked. Here's my code:
JSON Model
[
{
"nomeservizio" : "Frameworks",
"framewrok":[
{
"name":"none",
"cost": 40
},
{
"name":"bootstrap",
"cost": 0
}
]
}]
HTML
<div class="row" ng-repeat="voce in voices.data">
<h4 style="color:#000;">{{voce.nomeservizio}}</h4>
<div ng-repeat="cssframework in voce.framewrok">
<input type="checkbox" ng-model="cssframework.cost" ng-change="UpdateTotal({{cssframework.cost}})"/>
<span>{{cssframework.name}}........<b>{{cssframework.cost | currency}}</b></span>
</div>
</div>
<div class="row">
<h3>TOTAL: {{selectedVoices}}</h3>
</div>
JS Within Controller
$scope.UpdateTotal = function(parameter) {
$scope.selectedVoices = [];
$scope.selectedVoices.push(parameter);
}