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.

Reading the infoWindow opened status

See original GitHub issue

I want to close the infoWindow by clicking on the map, it is not possible to get the current status of the infoWindow so it will be impossible to close the opened infoWindow.

Get the feature (reading the infoWindow` opened status) added. Besides that. I don’t see a way to solve this. Maybe is is possible to remove the [x] button from the infowindow by some configuration, so that mapClick() is the only means to close the infoWindow, then you can be sure the state maintained by your code is correct.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

8reactions
sebholsteincommented, Jun 11, 2016

When you do something like this, you can:

<sebm-google-map>
  <sebm-google-map-info-window [ngFor]="let i of infoWindows" [isOpen]="i.isOpen">
  </sebm-google-map-info-window>
<sebm-google-map>
<button (click)="closeAll()">Close all infoWindows</button>
class MyMapComponent {
  infoWindows = [ {lat: 2, lng: 2, isOpen: true}, {lat:3, lng:4, isOpen: true}];

  closeAll() {
    this.infoWindows.forEach((i) => i.isOpen = false);
 }
1reaction
brian-singercommented, Jun 21, 2016

@SebastianM, hey! solution: save the infowindow status in the marker and then you can always check the states!

      <sebm-google-map-marker *ngFor="let m of markers; let i = index"
        (markerClick)="clickedMarker(i, $event)"
        [latitude]="m.lat"
        [longitude]="m.lng"
        [markerDraggable]="m.draggable"
        [iconUrl]="m.iconUrl"
        (dragEnd)="markerDragEnd($event)">

        <sebm-google-map-info-window [isOpen]="m.isOpen">
          <infowindow [eventMarker]="m"
                      [allEventMarkers]="markers"
                      [currentIndex]="i">
          </infowindow>
        </sebm-google-map-info-window>
      </sebm-google-map-marker>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading the infoWindow opened status · Issue #378 - GitHub
I want to close the infoWindow by clicking on the map, it is not possible to get the current status of the infoWindow...
Read more >
Check if infowindow is opened Google Maps v3 - Stack Overflow
Calling InfoWindow.getOpenedState() returns a boolean which reflects the state (opened/closed) of the infowindow. I chose to do it this way ...
Read more >
Info Windows | Maps JavaScript API - Google Developers
When you create an info window, it is not displayed automatically on the map. To make the info window visible, you must call...
Read more >
InfoWindow doesn't load in map when clicking label
In pset8, I currently have a working map with visible markers with label. However, when I click on one of the markers, no...
Read more >
Bug: InfowWindow.setContent() from domready event does ...
1) Add a "domReady" event to my infoWindow and set initial contents. 2) Issue an open() in subsequent processing relying on the listener...
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