I have the following driver.js:
var result = [];
var d = ["MS_SNA_CONTROL_TAB","MS_SNA_EXT_LOSS_TAB"];
for(var i = 0; i < d.length; i++){
var filter = {};
filter.name = d[i];
EOGService.query(queryP).then(
function(a) {
filter.results = a;
console.log("añade : " + d[i])
results.push(filter);
}
);
console.log("ha terminado: " + results);
}
My problem is that the order of the console is:
ha terminado: undefined
añade MS_SNA_CONTROL_TAB
añade MS_SNA_EXT_LOSS_TAB
And I need it to be
añade MS_SNA_CONTROL_TAB
añade MS_SNA_EXT_LOSS_TAB
ha terminado: object
Thanks