I want to combine the result of two asynchronouse function calls. I tried to get that as seperate functions.
$scope.showPage = function () {
var base ="";
var menu= "";
service.getGUI('menu', function (reply) {
if (reply.status === 200 && reply.data !== null) {
menu = reply.data;
}
});
service.getGUI('base', function (reply) {
if (reply.status === 200 && reply.data !== null) {
base=reply.data;
});
console.log("base:"+ base);
console.log("menu:"+ menu);
}
But the console output is not updating as expected. How can I execute is one by one and use the result of the first one in second function.