I have the below json object.
$scope.myDataList = [
{name:"one,two"},
{name:"three"},
{name:"four"},
{name:"five,eight,nine"}
]
I'm iterating the list and push the elements in the array as shown below.
$scope.myArray = new Array();
angular.forEach($scope.myDataList, function (value, key) {
$scope.myArray.push(value.name);
});
I want to push each element with comma spearated values also in the array.
example:
When I print $scope.myArray[0], it prints one,two.
But expected result is I want to print one for
$scope.myArray[0] and two for $scope.myArray[1], three for $scope.myArray[2].
Each value with comma separation also I want to push as an array element.
I tried as below but does not work.
var array = $scope.myArray.split(',');