Hey there, I have an array that looks like this:
$scope.Selectedgroups =[183,184,24]
I want to convert it to the format shown below:
[{groupId:183},{groupId:184},{groupId:24}];
I've been trying to convert it using a for loop:
var groups=[]
if($scope.Selectedgroups.length > 0){
for(i=0; i< $scope.Selectedgroups.length; i++){
groups.push({"groupId":$scope.Selectedgroups});
}
}
However, I'm getting an array format like this:
[{"groupId":[183,184,24]},{"groupId":[183,184,24]},{"groupId":[183,184,24]}]
Does anyone have a solution for this issue?