tombatossals / angular-leaflet-directive

AngularJS directive to embed an interact with maps managed by Leaflet library
http://tombatossals.github.io/angular-leaflet-directive
MIT License
1.5k stars 635 forks source link

Cannot read property 'style' of undefined #568

Closed sl45sms closed 9 years ago

sl45sms commented 9 years ago

on latest 11-12-2014 build I'm not sure if this is from leaflet or angular-leaflet-directive error.. seams like _contentNode not defined?

TypeError: Cannot read property 'style' of undefined at o.Popup.o.Class.extend._updateLayout (http://127.0.0.1:8000/js/leaflet-0.7.3/leaflet.js:7:21610) at updatePopup (http://127.0.0.1:8000/js/leaflet-directive/angular-leaflet-directive.js:3153:23) at _manageOpenPopup (http://127.0.0.1:8000/js/leaflet-directive/angular-leaflet-directive.js:3167:17) .....

on 04-12-2014 build this error not fired, but another with _contentNode.innerHTML undefined appears

TypeError: Cannot read property 'innerHTML' of undefined at t (http://127.0.0.1:8000/js/leaflet-directive/angular-leaflet-directive.min4-12.js:32:18709) at Object.fn (http://127.0.0.1:8000/js/leaflet-directive/angular-leaflet-directive.min4-12.js:32:22034)

sl45sms commented 9 years ago

related https://github.com/tombatossals/angular-leaflet-directive/issues/562

ralphdas commented 9 years ago

Experiencing the same issue here.. any possible workarounds? $compile?

fbrandel commented 9 years ago

This happens when changing the 'focus' property on the marker, see example at: http://tombatossals.github.io/angular-leaflet-directive/examples/0000-viewer.html#/markers/popup-example

nmccready commented 9 years ago

So it needs another null check here possibly, among other things. https://github.com/tombatossals/angular-leaflet-directive/blob/46d1a5a0b1af9b440ca22988cc0228ebf03ef72d/src/services/leafletMarkersHelpers.js#L141

Please make a PR with a fix and an example in examples which shows the original behavior resolved (already have above example).