question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(map-info-window): Set Content Dynamically

See original GitHub issue

Feature Description

For it to be posible to set data to each marker placed on the google-map.

Use Case

Referencing a well described previous issue with a similar use case as mine:

Hello, is it possible to have a custom info window with data for each marker? I am using markers for each position of products and on the window I want to show some of the products data. The API allows to set content on the infoWindow reference by setting content for each marker, so I tried to set the content before I open it but on this component we can only getContent() there is no setContent() function. Thanks!

_Originally posted by @ourabio in https://github.com/angular/components/pull/19378#issuecomment-634063771_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
crisbetocommented, Jul 23, 2020

If you’re doing exactly the same as the example, it’s probably because the reference inside the openInfoWindow is using ViewChild which picks up the first window in the view. Here’s how you can do it:

<map-marker #marker="mapMarker"
            *ngFor="let markerPosition of markerPositions"
            [position]="markerPosition"
            [options]="markerOptions"
            (mapClick)="window.open(marker)">
  <map-info-window #window="mapInfoWindow">{{ markerPosition.lat }} {{ markerPosition.lng }}</map-info-window>
</map-marker>
0reactions
angular-automatic-lock-bot[bot]commented, Aug 24, 2020

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic content in google maps api v3 info windows on ...
I have the below js that implements a google map with a looped through set of custom markers. I need each ...
Read more >
Info Window | Maps JavaScript API - Google Developers
Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will...
Read more >
Switching dynamically between infoWindow / Popup i...
//Change the content only if do not want to change the appearance of infoWindow. map.infoWindow.setContent("<div>I am no where</div>");.
Read more >
Query and immediately open info window - ArcGIS Developers
The function formats the InfoWindow, displays a graphic of the feature using map.graphics.add() , and shows the InfoWindow immediately using the map.infoWindow.
Read more >
Using the attribute inspector | ArcGIS API for JavaScript 3.29
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ... //Symbolize features by W/L record ... map.infoWindow.on("hide", function() {
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found