Just FYI - this issue was actually introduced in v2.2.x
Seems error has returned in typescript, I receive the below errors using 1.7.1 when navigating away from the route that contains the map.
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'remove' of undefined
TypeError: Cannot read property 'remove' of undefined
at LeafletDirective.push.TTNa.LeafletDirective.ngOnDestroy (leaflet.directive.js:107)
ERROR TypeError: Cannot read property 'invalidateSize' of undefined
at leaflet.directive.js:162
at ZoneDelegate.invoke (zone-evergreen.js:364)
at Zone.run (zone-evergreen.js:123)
---------Old reference ----------- Just FYI - this issue was actually introduced in v2.2.x
This should be fixed in 2.5.1, let me know if it's still an issue after you update.
Originally posted by @reblace in https://github.com/Asymmetrik/ngx-leaflet/issues/88#issuecomment-341927687
Their is the same problem on version 8.1.0, is it going to be corrected on this one as well ?
For information, I am on Angular 10 with @ngx-leaflet version 8.1.0 and when I arrive directly on the route with the leaflet directive I have :
core.js:4442 ERROR TypeError: Cannot read property 'remove' of undefined
at LeafletDirective.push.TTNa.LeafletDirective.ngOnDestroy (leaflet.directive.js:107)
at executeOnDestroys (core.js:9207)
at cleanUpView (core.js:9131)
at destroyViewTree (core.js:8957)
at destroyLView (core.js:9109)
at ViewContainerRef.remove (core.js:10219)
at ViewContainerRef.clear (core.js:10126)
at NgIf._updateView (common.js:3467)
at NgIf.set ngIf [as ngIf] (common.js:3444)
at setInputsForProperty (core.js:8797)
When i navigate from another page to this one via Angular routing, it simply does not display anything
This looks like it might just be an issue with not being defensive enough with the null checks. I'll take a look.
Of note, commit 1fd475cbead39b4addd6287ef0fb3d5e7233984e is looking like a likely candidate for a fix for this.