ui-leaflet icon indicating copy to clipboard operation
ui-leaflet copied to clipboard

Cannot read property 'address' of undefined

Open davidrhoderick opened this issue 9 years ago • 1 comments

I am trying to set the bounds for a leaflet map. I use the example code and it throws this error:

TypeError: Cannot read property 'address' of undefined
    at Object.fn (ui-leaflet.js:3160)
    at Scope.$digest (angular.js:16095)
    at Scope.$apply (angular.js:16359)
    at done (angular.js:10791)
    at completeRequest (angular.js:10989)
    at XMLHttpRequest.requestLoaded (angular.js:10930)

Definitely shouldn't throw this error and I think it's on the library side, not my usage, since I took it straight out of the documentation.

davidrhoderick avatar Feb 15 '16 18:02 davidrhoderick

I wanted to create a Pull-request, but after reading style guides etc grunt did nothing. So here just a comment on how to fix it - maybe I can get grunt running next week or so.

The error occurs if the bounds are undefined (in my case I load data from another webpage, then generate the bounds - before it's undefined). Therefore my solution would be to append || bounds === undefined to line 51 of bounds.js

fupduck avatar Apr 08 '16 15:04 fupduck