this.qS = this.afDatabase.list('path', ref => {
return ref.limitToLast(1000);
}).snapshotChanges().map(changes => {
return changes.map(c => ({ key1: c.payload.key,value1:c.payload.val() }));
});
this.qS.subscribe(values => {
let count: number = Object.keys((values)).length;
for(let i=0;i<count;i++){
let const2:number=Object.keys(values[i].value1).length; // is 3
for(let j=0;j<const2;j++){
console.log( values[i].value1[j]);//this line gives undefined why and How to get value from this?
}
}
});
values[i].value1 =>[object Object]
JSON.stringify(values[i].value1)=>
{"-LJ2PhylTGjo1Li6QxP4":{"dtime":{"befor_":0,"dates":"04-Aug-2018","from_t":14,"fullDetails":"Between 2 PM to 6 PM on 7-08-2018","id":1,"mDay":"7","mMonth":"08","mYear":"2018","to_t":18,"weak":2},"lan":0,"lon":0},"-LJ2PtF3X9OaH-5Lv982":{"dtime":{"befor_":0,"dates":"04-Aug-2018","from_t":14,"fullDetails":"Between 2 PM to 6 PM on 7-08-2018","id":1,"mDay":"7","mMonth":"08","mYear":"2018","to_t":18,"weak":2},"lan":0,"lon":0},"-LJIQjbtU7Ryz-gUcxRF":{"dtime":{"befor_":0,"dates":"07-Aug-2018","from_t":14,"fullDetails":"Between 2 PM to 6 PM on 8-08-2018","id":1,"mDay":"8","mMonth":"08","mYear":"2018","timestampCreated":{"timestamp":1533629365655},"to_t":18,"weak":3},"lan":0,"lon":0}}
Now we need to read fullDetails date from above string . How to do it in typescript ?