I need to get the the result outside the promise. Here is my code.
var NotList = share.getNotification();
Promise.all([NotList]).then(function(not_list) {
var report_list = not_list[0];
for (var n = 0; n < report_list.length; n++) {
var time_d = report_list[n].time;
var not_id = report_list[n]._id;
var PlantData = plant_details(report_list[n].plant_id);
Promise.all([PlantData, not_id]).then(function(result_arr) {
var plant_d = result_arr[0];
return notification_arr.push({notification_id: result_arr[1], parameter_name: "op_conductivity_val", plant_title: plant_d.title, message: "Plant output conductivity is low", notification_class: "danger", time: time_d});
});
}
});
console.log(notification_arr);
But am getting an empty array. Please help someone to sort out this issue.