I am currently using a FirebaseObjectObservable to retrieve the value of a property from my firebase database. The property can have multiple values, so I stored them in a local array variable.
However, I ran into an issue while trying to iterate through this local array variable using forEach. When I console.log the array variable, it appears to be in JSON format which may be why I'm having trouble iterating through it. Can someone please assist me in finding a solution to iterate through this variable?
* Code and Console Images :
* Edit *
I have now moved the code inside the subscribe method in order to iterate through it.
getAttachments() {
this.assignment.subscribe(asnDetails => {
if (asnDetails.fileKey) {
this.fileKeys.push(asnDetails.fileKey);
this.fileKeys[0].forEach(asnFileKey => {
this.asnFiles = this._getAsnService.getAssignmentFiles(asnFileKey);
this.asnFiles.subscribe(file => {
this.fileNames.push(file.name);
});
});
}
});
}