This is a question of an extension of a previously asked question. I have data in the ngOnInit see below and these fields are nor the same as the markers object.
Data from http get in my data.service.ts appending to
items:any = [];
ngOnInit() {
this.dataService.fetchData(this.slug)
.subscribe(
(data) => {
this.checkData(data);//in this function its going to be appending to this.items
}
);
}
checkData(data) {
if (data.length === 0) {
return this.router.navigate(['']);
}
return this.items = data;
}
markers =[
{
lat: 51.673858,
lng: 7.815982
},
{
lat: 51.373858,
lng: 7.215982
},
{
lat: 51.723858,
lng: 7.895982
}
]
So how can i overwrite the existing markers object with my this.items object (in this object is lat and lng available).
Awnser was correct from @Eric N and made the marker.latitude and marker.longitude parseFloat().
