Closed hirbod closed 10 years ago
Ok, I guess its my fault.
$rootScope.map.on(plugin.google.maps.event.MAP_READY, $scope.onMapInit);
After hours of programming I really seem to get blind after some time. Is there an off() function? I add the listener all the time... thats the reason...
Ok, there is an off() function but I can not chain it. But thats ok. Sadly, the listener doesn't get removed and this is for sure a bug. My console.log() seem to fire everything 2,3,4,5 times (depens how often I recalled)
Don't work: $rootScope.map.off(plugin.google.maps.event.MAP_READY); $rootScope.map.removeEventListener(plugin.google.maps.event.MAP_READY);
Even tried this: $rootScope.map.off(plugin.google.maps.event.MAP_READY, $scope.onMapInit); $rootScope.map.removeEventListener(plugin.google.maps.event.MAP_READY, $scope.onMapInit);
Works (YAY)!!! $rootScope.map.removeEventListener();
map.clear()
does not include map.off()
As of v1.2.2, map.remove()
will include map.off()
, but you need to call map.off()
in v1.2.1.
Allright, thanks for your quick response. That is fine!
:+1:
Hi Masashi, I guess I've found another bug. On my map I try to find the position and display it on the map. When I change the page and return, my last marker position got readded on the map again even I completly .remove() and .clear() everything before on init.
Just to make my point clearer: (please look at commentar in the code)
I have an AngularJS "MapController"
Now the init-function
And finally the success callback
Everything seems fine, but when I had another position before now I can see two markers.