Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Changin markers on scope, the model is different #343

Open
pabloalcaraz opened this issue Jul 9, 2017 · 2 comments
Open

Changin markers on scope, the model is different #343

pabloalcaraz opened this issue Jul 9, 2017 · 2 comments

Comments

@pabloalcaraz
Copy link

Hi,

I have a map with a filter that shows or hide depending of category of the marker you choose.

so, depending of the choose i have to update the $scope.markers variable.

I have a function on click on marker and the model the first time the map is loaded is the correct but when I apply a filter and put the new markers on scope variable the model is different.

In the leafletEvent object when click i get the good lat,lng, the label and icon correctly, but not the model.

I've tested with object {} instead of array [], I've done controls.markers.clean(), etc without success.

Can anyone tell me what I have to do for do this change of markers correctly?

Thanks.

@8Duke8
Copy link

8Duke8 commented Jul 25, 2017

Same issue here. If I change markers, I get wrong model on marker mouserOver, but in leafletEvent lat, lng are correct.

@bdirito
Copy link

bdirito commented Aug 9, 2017

I may have found the issue. When markers detects a change it checks watchTrap and aborts if this is true. watchTrap comes from modelChangeInDirective and acts as a throttling mechanism. The issue is if you abort you will miss your change until some other future change happens beyond the throttle timeout.

As a workaround I decorated leafletHelpers.modelChangeInDirective to do no throttling as i would much rather eat a possible performance hit then have wrong data.

in coffee:

.config ($provide) ->
    'ngInject'
    $provide.decorator 'leafletHelpers', ($delegate) ->
        'ngInject'
        $delegate.modelChangeInDirective = (trapObj, trapField, cbToExec) ->
            trapObj[trapField] = false
            cbToExec()
        $delegate

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants