Skip to content
This repository has been archived by the owner on May 11, 2020. It is now read-only.

Console Error: Cannot read property 'parentElement' of null when using maps-lazy-load-params on NgMap page #879

Closed
nicholaspretorius opened this issue Nov 1, 2018 · 9 comments

Comments

@nicholaspretorius
Copy link

Good day Allen,

When viewing the NgMap demo page at: https://ngmap.github.io/#/!map-lazy-load-params.html

A console error is displayed when clicking on the map marker to open the info window.

Steps to reproduce - no plunker provided as this exists on the NgMap demo page

  • Load url above with map-lazy-load-params example
  • Open developer tools in Chrome
  • Click on map marker to open an info window

Current behavior

  • When clicking on the map marker, a console error is displayed with the message:
    TypeError: Cannot read property 'parentElement' of null
    at info-window.js:114
    at angular.js:16299
    at completeOutstandingRequest (angular.js:4924)
    at angular.js:5312"

Line 114 of info-window.js

var infoWindowContainerEl = infoWindow.content.parentElement.parentElement.parentElement;

image

Expected/desired behavior

  • Info window should open without a console error.

Other information

  • If you close the info-window and then open it again, there is no console error.
  • This console error only happens on first load/click of the map marker.
@madmarcel
Copy link

I'm seeing the same issue. Working on a fix...

@maxdor1
Copy link

maxdor1 commented Nov 23, 2018

Any update on this?
I have the same problem in my project..

Thank you!

@allenhwkim
Copy link
Owner

I believe this happens because of a racing condition. I think Chrome browser tries perform faster than before. I can wrap like with a if condition

if (infoWindow.content.parentElement) {
  var infoWindowContainerEl = infoWindow.content.parentElement.parentElement.parentElement;
  infoWindowContainerEl.className = "ng-map-info-window";
}

allenhwkim added a commit that referenced this issue Nov 25, 2018
allenhwkim added a commit that referenced this issue Nov 25, 2018
@allenhwkim
Copy link
Owner

v1.18.5 is released with this fix

@nicholaspretorius
Copy link
Author

Thank you!

@wholeinsoul
Copy link

wholeinsoul commented Jan 19, 2019

v1.18.5 is released with this fix

HI @allenhwkim , when will you release this version v1.18.5 ?
Thank you.

EDIT:
For future reference: It is released here.
//cdn.jsdelivr.net/npm/ngmap@1.18.5/build/scripts/ng-map.min.js"

@Rouvo
Copy link

Rouvo commented Apr 24, 2019

Hi @allenhwkim,
I really like your library, but I ran into the same bug.

When are you going to realease the mentioned version with the bug fix?

@wholeinsoul
Copy link

For future reference: It is released here.
//cdn.jsdelivr.net/npm/ngmap@1.18.5/build/scripts/ng-map.min.js"

Hi @allenhwkim,
I really like your library, but I ran into the same bug.

When are you going to realease the mentioned version with the bug fix?

@Rouvo
Copy link

Rouvo commented Apr 25, 2019

Thanks for the quick reply, enjoy the day and thanks for your great work! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants