[FIXED] Display componnant inside PRIME-NG GMap infoWindow

Issue

there’s any way to display the component directly inside GMap infoWindow dialogue ?

I want to cahnge this html code (as string) directly by a component

Solution

Yes, You can get a reference pointing to that component using ViewChild, like

@ViewChild(ExampleComponent, { read: ElementRef }) exampleComponent: any;

Then you can access its HTML with nativeElement.innerHTML and use it in the infoWindow.setContent function

  handleOverlayClick(event: any) {
    this.infoWindow.setContent(this.exampleComponent.nativeElement.innerHTML);
    this.infoWindow.open(event.map, event.overlay);
    event.map.setCenter(event.overlay.getPosition());
  }

Answered By – בלימי בוימל

Answer Checked By – David Marino (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published