Reputation: 93
I fetch data from
$scope.roleinfo = {"QA":[{"White Box Testing":0},{"Black Box
Testing":0}],"Development":[{"Server Side":0},{"UI":0},{"Back end":0}]};
And displayed those value in table. Now I want to update maxcount and need to create array with keyvalue pair as below,
$scope.updatedmaxcount = {"QA":[{"White Box Testing":10},{"Black Box
Testing":20}],"Development":[{"Server Side":30},{"UI":5},{"Back end":10}]};
I have created a sample fiddle
Upvotes: 1
Views: 67
Reputation: 36
Hi, I think you just need to put "ng-model" in your input text control so that you will get the updated value in roleinfo object for whatever you will enter in the textbox.
<input type="text" name="maxcount" class="form-control5" autocomplete="off" ng-pattern="/^[0-9]*$/" ng-model="item[2]" value="{{item[2]}}">
and now when you clicked out Save Button, then you can call a function there and if in that function you access your scope.info object then you will see the updated values in info object itself.
Upvotes: 0
Reputation: 2111
You can do that using jquery with angular js. i have updated you fiddle click here
<input type="text" name="maxcount" class="form-control5" autocomplete="off" ng-pattern="/^[0-9]*$/" value="{{item[2]}}" id="newValue_{{$index}}">
i have just add id of all input with index and get value of input using his id.
you need to add jquery in your code
Upvotes: 1