How do we get the details of the layer when clicking on the ArcGIS map in angular 10. The click event is triggering on the map. Eg: A map showing house numbers. How do we get the house number when clicking on one of the house numbers on the map. I have to use the 'house number' in my code for other functionality.
this._view.on('click', function (event) {
console.log('click working');
//Need to get the value of clicked layer.
});
/Updated code/
this._view.on('click', function (event) {
this._view.hitTest(event).then(function (response) {
const graphic = response.results.filter(function (result) {
// return result.graphic.layer === hurricanesLayer;
return result.graphic.layer;
})[0].graphic;
console.log(graphic.attributes);
});
});
I am getting the error, 'Uncaught TypeError: Cannot read property '_view' of undefined'