Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to catch event on markers just one time #139

Open
hoanglethuanthien opened this issue Aug 6, 2019 · 0 comments
Open

How to catch event on markers just one time #139

hoanglethuanthien opened this issue Aug 6, 2019 · 0 comments

Comments

@hoanglethuanthien
Copy link

hoanglethuanthien commented Aug 6, 2019

I have task to search some address in one or more than polygon created. So I put function Search in

freeDraw.on('markers', function (event) {

                   if (event.eventType == 'create' && event.latLngs.length > 0) {
                       var coordinates = event.latLngs;
                       var feature = L.polygon(coordinates);
                       $scope.newBounds.extend(feature.getBounds());

                       if ($scope.$parent.SearchSalePropertyModel) {
                           $scope.$parent.SearchSalePropertyModel.Features.push(JSON.stringify(feature.toGeoJSON()));

                       } else {
                           $scope.$parent.SearchLeasePropertyModel.Features.push(JSON.stringify(feature.toGeoJSON()));
                       }

                   } else {
                       return;
                   }
                   $scope.$parent.Search($scope.newBounds);

               });

But the library re-draws all the polygons => make called server twice, how I fix it?

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

No branches or pull requests

1 participant