vendredi 27 août 2021

How to show bindPopUp() in Leaflet with angularjs

I am trying to use leaflet with angularjs. But I'm having trouble displaying array data table from "sensor" in "bindPopUp" content. Can anyone help me how to display the data?

This is the array I'm using

$scope.oAllMarker = function() {
  $scope.location = [{
    "loc": "Jodhpur",
    "lat": 26.28,
    "long": 73.02,
    "sensor": [{
        "v1": 11
      }, {
        "v2": 12
      }, {
        "v3": 13
      }]
   },
   {
     "loc": "Bikaner",
     "lat": 28.0229,
     "long": 73.3119,
     "sensor": [{
        "v1": 21
      }, {
        "v2": 22
      }, {
        "v3": 23
      }]
    },
    {
      "loc": "Churu",
      "lat": 28.3254,
      "long": 74.4057,
      "sensor": [{
        "v1": 31
      }, {
        "v2": 32
      }, {
        "v3": 33
      }]
    }
  ];

And this is the angularjs and leaflet code i am using

  angular.forEach($scope.location, function(item, key) {
    $scope.dataIcon = L.icon({
      iconUrl: "",
      iconSize: [38, 45]
    });
    $scope.content = String('Table:Array sensor (v1,v2,v3)');
    marker = new L.marker([parseFloat(item.lat), parseFloat(item.long)], {
      icon: $scope.dataIcon
       }).addTo($scope.map).bindPopup($scope.content);
  });
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire