Esri / esri-leaflet

A lightweight set of tools for working with ArcGIS services in Leaflet. :rocket:
https://developers.arcgis.com/esri-leaflet/
Apache License 2.0
1.61k stars 799 forks source link

get event in angularJS #1118

Closed emazzu closed 6 years ago

emazzu commented 6 years ago

ie: Chrome Version 67.0.3396.99 (Official Build) (64-bit)

https://unpkg.com/leaflet@1.3.3/dist/leaflet.js

https://unpkg.com/esri-leaflet@2.2.1/dist/esri-leaflet.js

Steps to reproduce the error:

hi, how are you, I works in angularJS, the event works good, but "$scope.a", seems lo lost the value.

or I can customize the popup with boostrap ???

     a1[7] = L.esri.featureLayer({url: "http://nahwgis01/ArcGIS/rest/services/SINOPECGIS/AH_InstalacionesPozos_GSJ/MapServer/35", useCors: false}).on("click", groupClick);

            var properties = null;

            function groupClick(event) {

                for (const [key, value] of Object.entries(event.layer.feature.properties)) {
                    console.log(key + " " + value);
                }

                $scope.a = event.layer.feature.properties;
                console.log("scope:  " + JSON.stringify($scope.a));
            }

            // create - creamos objeto map
            var map = L.map('map', {
                center: [-41.735511, -65.989406],
                zoom: 5
            });

            // load - Esri's World Streetmap tiles
            var esriStreets = L.esri.basemapLayer('Imagery').addTo(map);

            // declare - control para activar / desactivar capas
            var overlayMaps = {
                "Areas de Concesión": a1[0],
                "Distritos": a1[1],
                "Provincias": a1[2],
                "Pozos Activos": a1[3],
                "Pozos Inactivos": a1[4],
                "Baterías": a1[5],
                "Plantas de Agua": a1[6],
                "Plantas de Gas": a1[7],
            };

            L.control.layers(null, overlayMaps).addTo(map);
jgravois commented 6 years ago

tough to say. mostly because i've never written an angular app.

if you can provide a simplified, ready to run repro case here its possible someone can help but its a better question for Stack Exchange or Geonet.