I am new in angular.
i want extract data from an observable. i do that :
validnomi(key : string): void {
this.demandesnomiftodisplay =
this.demandenomisService.getSingleDemandenomis(key).subscribe(val =>
{const civ = val[0].civ;
const datedemande = val[0].datedemande;
const nom = val[0].nom;
const prenom = val[0].prenom;
}
);
}
my service.ts :
getSingleDemandenomis(key: string){
return this.database.list('/Demandes/DemandesBALnominatives', ref => ref.orderByKey().equalTo(key)).snapshotChanges().pipe(map(actions => {
return actions.map(a => {
const data = a.payload.val();
const key = a.payload.key;
return {key, ...data };
});
}));
}
But i have this error :
property prenom does not exist on type {key : string}
property nom does not exist on type {key : string}
property civdoes not exist on type {key : string}
....