Skip to content Skip to sidebar Skip to footer

Leaflet .locate Watch Option Breaks .locate After Changing Tab Ionic 3

I have one function called loadmap(){} where im creating map.Im loading this function with ionViewDidEnter() { this.loadmap(); } Inside loadmap i have this.map = leaflet.m

Solution 1:

You have to call map.stopLocate() besides map.remove():

Stops watching location previously initiated by map.locate({watch: true})

Live demo: https://plnkr.co/edit/PKMPjfX3zD3QdWmEI0iX?p=preview (use the "Toggle map" button to simulate your changing tabs)

That being said, it is true that Leaflet could automatically do this when using the remove map method. => Merged in PR Leaflet/Leaflet#5893

Post a Comment for "Leaflet .locate Watch Option Breaks .locate After Changing Tab Ionic 3"