tombatossals / angular-leaflet-directive

AngularJS directive to embed an interact with maps managed by Leaflet library
http://tombatossals.github.io/angular-leaflet-directive
MIT License
1.5k stars 637 forks source link

using markercluster breaks message compilation #657

Closed nickolas1 closed 9 years ago

nickolas1 commented 9 years ago

If you are using a template via ng-include in a label message, and the marker is part of a markercluster group, compilation of the message doesn't appear to work correctly.

I tried to make a plunker showing this but it seems that putting the example into plunker broke the label message compilation even for non-grouped markers: http://plnkr.co/edit/o7jb3pZwfNZeB0nVvZBq?p=preview

the equivalent grouping with plain messages instead of labels works fine: http://plnkr.co/edit/ZMWJKOC0oExQEQu64J9Q?p=preview

davidovich commented 9 years ago

@tombatossals I will check this when I have a little time.

nmccready commented 9 years ago

Plnkr seems to be down. Anyways it seems to working better with the latest. use <script src="http://cdn.rawgit.com/tombatossals/angular-leaflet-directive/master/dist/angular-leaflet-directive.js"></script>

In your dependencies.

nmccready commented 9 years ago

Did you trying debugging the code?

nickolas1 commented 9 years ago

it does work better with the latest master, but I still see issues relating to markers that are initially part of a cluster. see comments on #666 which I think are the root issue now.

nmccready commented 9 years ago

http://plnkr.co/edit/1oOLAEE2TJHA8AJzGAHs

nmccready commented 9 years ago

@jessertaylor ?

nmccready commented 9 years ago

Guilty logic is here or here nvm it is label my bad

nmccready commented 9 years ago

problem is really here https://github.com/tombatossals/angular-leaflet-directive/blob/master/src/services/leafletMarkersHelpers.js#L164

When

$compile(marker.label._container)(labelScope);

Is hit, if it is a cluster _container is undefined. i think _container is only defined when it is visible (ie not a cluster). In reality we should be setting content via setContent after post compile. The when the clusterer makes it visible the _container is made correctly under the hood. This is why you should use accessors and not use private members.

nmccready commented 9 years ago

My attempt to fix it is not working.

nmccready commented 9 years ago

I am wondering if we need to hook to https://github.com/Leaflet/Leaflet.markercluster event animationend and re-check the markers who's labels were not ready.

nmccready commented 9 years ago

Got it working http://plnkr.co/edit/1oOLAEE2TJHA8AJzGAHs?p=preview