Select to view content in your preferred language

Intro to PopupTemplate sample code doesn't use the Popup component?

66
2
Jump to solution
4 hours ago
AntonioMedrano
Emerging Contributor

The Intro to PopupTemplate sample code has the Popup component in the code, but then it autocasts the popup template into the popupTemplate property of the feature layer. I believe that you can delete line 29 of the code where it adds the popup component and it will still behave exactly the same, especially since we didn't add any extra actions to the popups. The first sentence of the page description talks about the new Popup components, but they don't actually seem to be used in the code. Is this really true, or am I missing something? Thanks.

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Esri Frequent Contributor

The way the popup component works, is if you add the `arcgis-popup` to the `popup` slot, it is now the popup used when you click on the map. If you don't add it, the popup widget is used. In the sample, you don't need to interact with the popup for it to be used. I'm glad you didn't notice a difference, that means it's doing it's job 🙂

I recently did a video on the popup component you can see here!

View solution in original post

2 Replies
ReneRubalcava
Esri Frequent Contributor

The way the popup component works, is if you add the `arcgis-popup` to the `popup` slot, it is now the popup used when you click on the map. If you don't add it, the popup widget is used. In the sample, you don't need to interact with the popup for it to be used. I'm glad you didn't notice a difference, that means it's doing it's job 🙂

I recently did a video on the popup component you can see here!

AntonioMedrano
Emerging Contributor

Thanks @ReneRubalcava, this explains a lot. Adding the component is all under-the-hood in this case, and since the widget still works in 4.34 and we're not doing anything fancy like docking or actions, then the behavior is exactly the same with or without the component. Thanks for the reply and video.

0 Kudos