How to display google coordinates from a request

I want to display the location base on the value that I get from getLocation but all I get is a blue screen if I assign for example, this.lng=26,777; but it does not if a did like this; this.lng=this.LNG; and it works fine one last thing l would like to mention that the datatype in the database is double and I have tried testing a text as well


  constructor(public dataservice:DataService,private geolocation: Geolocation) {
  .subscribe(data =>{this.LAT = data[0].lat,
    this. LNG=data[0].lng;


<agm-map [latitude]="lat"[longitude]="lng" [zoom]="10"
  <agm-marker  [latitude]="lat" [longitude]="lng"></agm-marker>

Why do you have two sets of properties for the same data?

well because I need one property to store the latitude value and another for the longitude

I am asking why you need two latitude and two longitude.

ah yeah I try adding the LAT and LNG properties in latitude]=“LAT”[longitude]=“LNG” and it doesn’t work I still get the blue screen so I thought maybe if I ass to another property it may work I was testing some ideas hoping one would work

What? A screen with blue background or are you talking about Windows blue screen for fatal errors?

console.log(data); before you work with it to see if it contains what you want at all.

Also: Your code indentation sucks and makes it very hard to read.

What is this?

Why do you need lat/lng on both the map and the marker?

first, this is the blue screen I am talking about
second I am really sorry about my indentation and yes I have try to log the data and it contains the correct data

the [quote=“Sujan12, post:6, topic:98594”]
this is an Angular Google Maps (AGM)

the first lat/lng will initial center position for the map
and the second is for the marker

That looks like water to me. What does it show when you zoom out?

I would output the data in your page as well, or at least console.log it and show us the result. Maybe these values are actually somewhere in the middle of the ocean?

Provide a link please.

So this is a little embarrassing it was water but the the coordinate are not in the middle of the ocean
so I don’t know why is there 47.6205099,-122.3514661

Where exactly are you logging this? If this is your data returned by the subcribe, this could be your root problem: This doesn’t seem to have any lat or lng properties but just two entries - so it seems to be an array with 2 values?

From the example on the homepage:

export class AppComponent {
  lat: number = 51.678418;
  lng: number = 7.809007;

Seems lat and lng should be of type number, not string as you seem to have. (at least that’s what I get from the console output of data)

yeah that right I add parseFloat(this.Code) and it work