I don't understand why it doesn't enter in the for loop, any ideas?
async getAllApis() {
const apis: Api[] = [];
console.log( this.all_api_id ); /* Output on console (correct):
0: "aura-insight-events"
1: "audit"
2: "consent-events"
3: "backoffice"
*/
console.log( typeof(this.all_api_id) ); # Output on console (correct): Object
for await ( const id of this.all_api_id ) {
console.log( id ); # No answer ¿?
this.getAPIbyID( 'apis', id ).subscribe( ( api: Api ) => {
console.log( api ); # No answer (obviously)
apis.push( api[0] );
});
}
console.log( apis ); # Output on console: [] => length: 0
this.apis = apis;
}
I've tried in several ways but neither of them made any effect.. I don't understand why the code is acting like this -- if anyone does understand, please let me know