Search code examples
javascriptangularjsarcgisesriarcgis-js-api

Show pin on the map after clicking the custom button on the pop-up


I am using ArcGIS JS API 4.0 with angular. On the pop-up, I have added the custom button More details, On the click of that button i want to show the pin on the map. I dont find much online examples to achieve this, can anybody help?


Solution

  • If I understand correctly, your issue is to get the location of click within the action method.

    If so, you can get the location from the view.popup.location. which is a point geometry. With that you can add a new Graphic to the layer or on the map. I have not worked with AngularJS. so would not be able to provide you with sample. but with the location details available, it should be easy to find a sample to add a graphic.

    Edit: This sample is more appropriate. https://developers.arcgis.com/javascript/latest/sample-code/get-started-graphics/index.html