How to store a table value in a AGM field in the database?

Asked

Viewed 14 times

0

Hello I am developing a project with Angular, Firebase and Android. The project is a tracking system,by the mobile application is picked up the location, in Longitude and latitude, and these values are played in Firebase. With a Dashboard created in Angular, it must read and project the location using AGM (Angular Google Maps) the same has already been configured and is functional.

import {AgmCoreModule} from '@agm/core';
imports: AgmCoreModule.forRoot({
      apiKey: 'minha chave'
    })

This is the format to design google maps:

<agm-map class="mapa1" [latitude]="lat" [longitude] = "lng">
        <agm-marker [latitude]="lat" [longitude] ="lng"> </agm-marker> 
      </agm-map>

Both the variable "lat" and "lng" are stored in Component.ts

export class PerfilmotoristaComponent implements OnInit {
 lat =-23.774109;
  lng =  -49.948239;
}

I would like it to be possible to replace these static values with values that are generated in firebase. ps: Firebase is already configured in the project

  • has tried this.firebase.pegDados(). subscribe(data=>{ this.lat=data.lat...

  • this.lat = data would be the field name of my table?

  • In order for you to transfer the data from Firebase to your project, you have to bind between the html component that you want to receive the data, for this you must create a variable in your Component.ts equal to the value field of your Component, in the lat and ing case, these variables will receive data from your getService as Eduardo passed there.

  • In the part of doing the get everything worked out the same as Eduardo committed, but when passing this pro agm he throws the location to the sea, what could be?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.