vm.owners = parents.children.map(function(e) {
getparentById(e.Id)
.then(function(getresponse) {
var parentLink = '<a href="/#/parent/onboard/' + e.Id + '" target="_blank">' + e.Number + "-" + e.Name + "-" + getresponse.code + '</a>';
return parentLink;
})
.finally(function() {
vm.isLoading = false;
});
}).join(' || ');
The code above is attempting to concatenate the values of a looped function with '||' as it iterates through children and makes an API call using getparentbyid. The issue arises when trying to combine the results into a single string due to where the HTML concatenation takes place. Moving it outside the getparentbyid API call works for combining with '||', but the data from getresponse is then inaccessible. Placing it inside the getparentbyid function results in empty spaces being joined by '||'. The challenge here is finding a way to successfully join both pieces of data together. Any suggestions on how to address this dilemma?