Google Map load markers from database server


#1

I’m trying to load the markers from mySQL database

loadMap() {

    let location = new GoogleMapsLatLng(14.678999, 120.540372);

      this.map = new GoogleMap('map', {
        'backgroundColor': 'white',
        'controls': {
          'compass': true,
          'myLocationButton': true,
          'indoorPicker': true,
          'zoom': true
        },
        'gestures': {
          'scroll': true,
          'tilt': true,
          'rotate': true,
          'zoom': true
        },
        'camera': {
          'latLng': location,
          'tilt': 30,
          'zoom': 15,
          'bearing': 50
        }
      });

  this.map.on(GoogleMapsEvent.MAP_READY).subscribe(() => {
  console.log('Map is ready!');
  this.getUserLocation();

   this.service.getMaps()
      .subscribe( data1 => {
        let loc = data1;

    for (var i = 0; i < loc.length; i++) {
        var record = loc[i];
        let latlng = new GoogleMapsLatLng(record.location);
        let markerOptions: GoogleMapsMarkerOptions = {
        position: latlng,
        title: record.title,
        };

        this.map.addMarker(markerOptions)
        .then((marker: GoogleMapsMarker) => {
         marker.showInfoWindow();
         });
        }
      }, err=>{
      alert(err);
    });
});
}

#2

please help me pleeease!