@mairaeva wrote:
I’m trying to manipulate my data (get the GPS position of users) from Firebase within the TS controller.
I can do that in the template but how to get the “GPS” fields within the TS ?here is my Observable list from firebase (map.ts) :
this.items = database.list('user').valueChanges();
Here is how to display them within the template (map.html) :
<li *ngFor="let item of items | async"> {{ item.GPS }} </li>
I guess I am supposed to subscribe and then do a FOREACH loop like this
database.list('user').valueChanges().subscribe(res => { console.log("res" + res); res.forEach(item => { console.log("item" + item.GPS); }); });
But off course the “GPS” field is unknown
Here is my JSON DATA from firebase
"user" : { "-KxFJWl6Hcq8sguzqHUO" : { "GPS" : "-17.6118169,-149.6097454", "mail" : "xxx@xxxx.com", "timestamp" : 1508907172088 }, "-KxFKYmHnd3dzlaNgrR3" : { "GPS" : "-17.6118169,-149.6097454", "mail" : "xxx@gmail.com", "timestamp" : 1508907133193 }, "-KxGPgl0HSD4k60GxDba" : { "GPS" : "-17.551625100000003,-149.5584758", "mail" : "xx@xxx.com", "timestamp" : 1508899499230 } }
ionic 3.15.0
angularfire 5
Posts: 1
Participants: 1