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
CodePudding user response:
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());
}
