I have a list that loads from the firebase. This list has 3 attributes, value, id, and date. But I'm going to need to capture just one of these attributes and mount an array with them, so I can do a math calculation, so I need to extract the property (value) from there. I researched map, and subscribe, but I could not get a satisfactory result, it always returns me [object object] in the console. Could someone help me?
recompensas : Observable<Recompensa[]>;//meu observable
public recompensa = {} as Recompensa;//meu model de dados
//exibindo a minha lista na view
ionViewDidLoad() {
this.recompensas = this.recompensaProvider.buscarRecompensa(true);
}
//minha tentativa de realizar o map e subscribe, sempre obtenho [object
//Object] no console
teste() {
const test = this.recompensas.subscribe(recs => recs.map(rec =>
rec.valor ));
console.log('valor de teste : '+test);
}
teste() {
const test = this.recompensas.map(recs => recs.map(rec =>
rec.valor ));
console.log('valor de teste : '+test);
}