please take a look at this dropdown
In my array list displayed as ng-option, some values come as PCBUs separated by commas. For example, in the JSON response, the value of the first PCBU is "NKSMO,NNOWR". I am attempting to display these as two separate PCBU options: "NKSMO" and "NNOWR" in the ng-option, instead of one combined option.
JSON Response
"statusType":"success",
"statusMsg":{
"approvals":{
"inProgress":[
{
"projectStatus":"Pending Decision",
"pcbu":"NKSMO,NNOWR",
"statusUpdatedDate":"2019-07-31 15:04:30",
"requestType":"PORCHNGEREQ",
"folderStatus":false,
"projectName":"TEST POR CAHNGE REQ",
"priority":"NORMAL",
"projectId":24324
},
{
"projectStatus":"Pending Decision",
"pcbu":"NKSMO",
"statusUpdatedDate":"2019-05-24 09:41:36",
"requestType":"PORCHNGEREQ",
"folderStatus":false,
"projectName":"Mobile Test - Jack - POR 1",
"priority":"NORMAL",
"projectId":23351
}
],
$scope.pcbuSelect = "";
$scope.loadRequests=function(requestType){
var jsonObj = {
"userId":$scope.userId,
"requestType":requestType
};
workflowProjFundFactory.getApprovalRequest(jsonObj)
.success(function(data, status) {
if (JSON.stringify(data.statusType).indexOf("success") > -1) {
var allrequests = data.statusMsg;
$scope.inProgressDataList=$scope.inProgressDataList
.concat(allrequests.approvals.inProgress) ;
$scope.pcbuList = $scope.inProgressDataList
.concat(allrequests.approvals.pcbu);
}
}
}
<label for="PCBU" class="control-label-left typeAllOptionStyling">PCBU</label>
<div class="selecteddiv" style="margin-right: 1%;">
<select ng-model="pcbuSelect" name="pcbuSelect"
ng-options="removeUndefined(item.pcbu) for item in pcbuList | unique:'pcbu'"></select>
</div>
I have attempted to use the split method to separate the comma in the array, but it has not been successful for me.