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

Is it possible to GEOJSON open popup by GET param in the url? #1196

Open OmegaSkiller opened 2 years ago

OmegaSkiller commented 2 years ago

I need to open a popup on geoJSON feature by GET. I cant find how is this possible here is my geojson layer setup code:


                angular.extend($scope.layers.overlays, {
                    sold: {
                        name: 'Sold Land',
                        type: 'geoJSONShape',
                        data: data,
                        visible: true,
                        layerOptions: {
                            style: {
                                color: '#ff0000',
                                weight: 1,
                                fillOpacity: 0,
                                opacity: 1,
                            },
                            onEachFeature:
                                function (feature, layer) {
                                layer.on('click', function (e) {
                                    $http.get("/ajax.php?landId=" + feature.properties.id).success(function (data, status) { //var landData =
                                        var landDiv = document.getElementById('sold-detail-' + feature.properties.id);
                                        landDiv.innerHTML = data;
                                        return data;
                                    });
                                });
                                const popup = L.responsivePopup({className: 'buyPopup'}).setContent('<div class="buyPopup" id="sold-detail-' + feature.properties.id + '">Loading...</div>');
                                layer.bindPopup(popup);
                            },
                        },
                    },
                    selectedLand: {},
                });
                    // Put the cells on an associative array
                $scope.cells = {};
                for (var i = 0; i < data.length; i++) {
                    var cell = data[i];
                    $scope.cells[cell['properties']['type']] = cell;
                }
            });```