import { Component, AfterViewInit, ViewChild, Input, ElementRef } from '@angular/core'; @Component({ selector: 'map-viewer', templateUrl: './map-viewer.component.html', styleUrls: ['./map-viewer.component.css'] }) export class MapViewerComponent implements AfterViewInit { @ViewChild("mapContainer", { static: false }) gmap: ElementRef; map: google.maps.Map; @Input() kmlFileUrl; @Input() title; constructor() { } ngAfterViewInit(): void { const map = new google.maps.Map( this.gmap.nativeElement ); const kmlLayer = new google.maps.KmlLayer({ url: this.kmlFileUrl // url: "https://filebin.net/meeczcd4ghmudmoc/first.kml?t=ql0ran12" }); kmlLayer.setMap(map); } }