I'm pretty new to AngularFire, Firebase, rxjs etc..
Can anyone tell me why the following returns 'undefined' from console.log?
this.af.database.object('/teams/' + this.id)
.map((data) => {
data.teamName = Teams[data.team];
})
.subscribe((data) => {
console.log(data)
})
Teams is an enum. Red = 1, Blue = 2...
I know the problem lies in the .map as if i remove it and just log x or log the enum lookup both work fine..
This works fine (and resolves red):
this.af.database.object('/teams/' + this.id)
.subscribe((x) => {
console.log(Teams[x.team]);
})
As does this (resolving a firebase observable):
this.af.database.object('/teams/' + this.id)
.subscribe((x) => {
console.log(x);
})
I've also tried flatMap on a list rather than map on an object.
Any help would be appreciated.