Try this code, this work is my project
Google white paper here
import GoogleMapsLoader from 'google-maps';
import { google } from 'google-maps';
ngAfterViewInit() {
let el = this._elementRef.nativeElement.querySelector('.contact-us');
GoogleMapsLoader.KEY = 'g4554645645645645645646';
GoogleMapsLoader.load((google) => {
let myLatlng = new google.maps.LatLng(23.5454, 90.8785);
let map = new google.maps.Map(el, {
center: new google.maps.LatLng(23.8787878, 90.87878),
zoom: 18,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
let marker = new google.maps.Marker({
draggable: true,
animation: google.maps.Animation.DROP,
position: myLatlng,
map: map,
title:"Hello World!"
});
});
template.html
<div class="contact-us" style="position: relative; height: 470px;"></div>
source
share