I have a subscribed to a FirebaseObjectObservable to get value of a property of an object from my firebase database. This property can contain multiple values so I stored the values in a local array variable.
But I am unable to iterate through this local array variable using forEach. So I console.log this array variable. This variable seems to have json format maybe thats why I am unable to iterate. Please help me find a way to iterate through this variable.
* Code and Console Images :
* Edit *
I shifted the code inside the subscribe method to iterate.
getAttachments() {
this.assignment.subscribe(asnDetails => {
if (asnDetails.fileKey) {
this.fileKeys.push(asnDetails.fileKey);
this.fileKeys[0].forEach(asnFileKey => { // <---- shifted this forEach loop inside subscribe
this.asnFiles = this._getAsnService.getAssignmentFiles(asnFileKey);
this.asnFiles.subscribe(file => {
this.fileNames.push(file.name);
});
});
}
});
}