I am writing in my save method but here am getting as a list of array. but wanted to convert to set of string.
mySys: $scope.stringArrayToObjectArray($scope.editmySystems,"name");
$scope.editmySystems holds value-
0 :f
id: svg
name:"JASSI"
1 :f
id: svg2
name:"JASSYY"
length: 2
So for conversion i wrote one function-
$scope.stringArrayToObjectArray = function(stringArray, fieldName) {
var objectArr = [];
angular.forEach(stringArray, function(singleString) {
objectArr[fieldName]=singleString.name;
});
return objectArr;
};
currently objectArr is returning as-
name: "JASON2"
Expected o/p- objectArr should return-
name: ["JASSI","JASSYY"]
Please suggest
objectArr[fieldName]=singleString.name;to do?