I'd like to pass in a string from one of my functions that will let another function know which array to update within another array. All the attempts I've tried end in poor errors that really don't lead me anywhere productive so far.
function likeFeedItem(itemId, feedItemIndex) {
postActionsService.likeFeedItem(itemId)
.then(function success(response) {
var resource = 'capabilities.chatterLikes';
ctrl.testUpdate(response.data, feedItemIndex, resource);
})
.catch(ctrl.showError)
};
function testUpdate(feedItemData, feedItemIndex, resource) {
ctrl.feedResult.elements[feedItemIndex] . resource = feedItemData.resource;
// Output should work/look like this would
ctrl.feedResult.elements[feedItemIndex].capabilities.chatterLikes = feedItemData.capabilities.chatterLikes
}