There is sample of Custom UI component with React and Vite:
https://github.com/Esri/jsapi-resources/tree/main/esm-samples/jsapi-custom-ui
Is there any sample of Custom UI component with Angular?
I have resolved this problem.
Thank you, Andy!
I found some clue: dynamic component loading (https://angular.io/guide/dynamic-component-loader#dynamic-component-loading).
It's using viewContainerRef of directive to create component and set up data:
const viewContainerRef = this.adHost.viewContainerRef;
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent<AdComponent>(adItem.component);
componentRef.instance.data = adItem.data;
But how to get ViewContainerRef of the popup content in our case?
Yes, you seem to be on the right right track for integrating the CustomContent Class: https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-CustomContent.html. The CustomContent.creator function can be used to return an HTMLElement. In your case this will be an Angular component. You'll need to pay attention to data binding and component life-cycle. Experiment and see how it goes. Please post your findings here so others can learn, or others may have already gone down this path and respond back.
I want to create a CustomContent for popup. I have an Angular component "my-popup". Is it right?
If I have Angular component "my-ui", what's the Custom UI component? {<app-my-ui><app-my-ui>}?
Hi @ForrestLin there is not an Angular sample. However, the conceptual doc's Introduction spells out how to do it in any framework: https://developers.arcgis.com/javascript/latest/custom-ui/#introduction.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.