0

Edited: After some advices i came back to old version of how i wanted handle angular and leaflet, link to fiddler but still is not working,

Explanation: It was working with angular-leaflet-directive, but this directive has very bad performance on firefox, to compare leaflet.js self is very good so i thought i will try to make some small directive on my own, maybe somebody has some advices what is wrong and how to fix it?

Link to fiddler:

fiddler

I try to pass result from ng-repeat to leaflet directive, but when i do it, angular start "Error: 10 $digest() iterations reached. Aborting!, there is no problem when i pass just data to directive. I tried few things but without result. I cannot even see markers. If the problem is in directive?

 <body ng-app="directoryAppMap">
<div ng-controller="DirectoryMapListController">
    <input ng-model="search" placeholder="Name" />
    <table id="table">
        <thead>
            <tr>
                <th>Name</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="hf in FilteredGeojson = (data | filter:search)">
                <td>{{ hf.properties.name }}</td>
                <td>{{ hf.geometry.coordinates }}</td>
            </tr>
        </tbody>
    </table>
    <div leaflet-directive id="map" data="FilteredGeojson"></div>
Igor
  • 1,384
  • 3
  • 17
  • 34
  • It appears the example you posted with a fiddler link is not the version of your app which is exhibiting the error you describe? – Claies Feb 11 '15 at 21:55
  • okey i was not cautious, i just correct the question – Igor Feb 11 '15 at 22:15
  • I still don't see where your ng-repeat is interacting with your directive here? – Claies Feb 11 '15 at 22:18
  • in fiddle that i made, when i start searching i see a lot of errors like infinite digest loop and zero markers on map, when i pass just plain data to leaflet directive everythings fine, i dont know how to explain it in more details, sorry – Igor Feb 11 '15 at 22:20
  • ok, so you have 2 different issues here. errors that are happening when trying to use the search filter have nothing to do with the directive; also, your ng-repeat isn't interacting with the directive. – Claies Feb 11 '15 at 22:23
  • I tried to make watch on data but haven't helped to, so in your opinion what is the reason that markers are not showing on the map? – Igor Feb 11 '15 at 22:34
  • What you are doing will never work. `FilteredGeojson` only exists within the ng-repeat, you can't use it outside of that. You're expecting that `FilteredGeojson` somehow magicly will get assigned to your controller's scope so that it can then be used by the directive. It won't. You've got to use a filter in your controller to manipulate your data so that it can be used by your ng-repeat and the directive. Just like i've already once explained to you in uttermost detail: http://stackoverflow.com/questions/27757491/how-make-ng-model-search-have-influence-on-leaflet-directive – iH8 Feb 11 '15 at 22:35
  • I solved it in different way then you showed me everything worked fine but map was very slow on firefox, just a sec i will make another fiddler with filtering in controler, i did as you said before but i was not working so i tried something else – Igor Feb 11 '15 at 22:54
  • link to new fiddler http://jsfiddle.net/ior88/ecte59sq/2/ with filtering in controller – Igor Feb 11 '15 at 23:17

0 Answers0