Mahesh Reddy

Mahesh Reddy

  • NA
  • 363
  • 15.5k

save one array values to another array using anjularjs

Nov 24 2018 12:15 AM
I have 2 arrays
$scope.taxes=[];
(at taxes i have 1 field named as value)
$scope.subitems=[];
(at subitems i have 1 field named as text)
the values what ever we enter(taxes) that can be saved to (subitems)
values ---> text
after clicking of save function i want to assign text values(taxes) to value field(subitems) subitems
could anybody please suggest me how to assign taxes(text field values) values to subitems(value fiedvalues)
this is what i have wrote
var subitems = [];
for (var i = 0; i < $scope.taxes.length; i++) {
var item = {};
for (var j = 0; j < $scope.taxes[i].length; j++) {
item.text = $scope.taxes[i].Value;
subitems.push(item);
}
}
at save functionality i am assigning taxvalues to subitems value
i don't know whether this is right or wrong
could please any body help me
Code

Answers (5)