Inject Angular Component As Popup Content

458
3
08-06-2021 09:41 AM
rogenjh
New Contributor III

Hey Everyone,

This is a question I've wondered about for a while, so I'll pass it to the community here.

Is it possible to inject an Angular component as ESRI popup content? If so, does someone have an example of this working? I've poked around for a while and haven't found anything specific enough to help me.

Thanks!

0 Kudos
3 Replies
AndyGup
Esri Regular Contributor

Hi @rogenjh, can you explain a bit more about what you want to do?  In general that seems problematic with all the external dependencies and life-cycle hooks that are inherited with an Angular component. It wouldn't be a clean implementation. 

0 Kudos
rogenjh
New Contributor III

Hey Andy,

I'm looking for something like this (what I posted below), but Angular not React. Basically, I'd like to inject a component as the content and be able to access change detection, dependency injection, etc. just like the rest of my application. I've done it (and seen others do it) by writing Vanilla js into a factory function in the content, but I'd think there should be a way of avoiding that if possible.

https://community.esri.com/t5/arcgis-api-for-javascript-questions/create-your-own-react-popup-compon...

0 Kudos
AndyGup
Esri Regular Contributor

I've seen similar implementations and they aren't recommended because it can lead to unintentional memory leaks in the form of detached DOM nodes and other unpredictable Map/MapView life-cycle issues.