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?
Solved! Go to Solution.
I have resolved this problem.
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.
If I have Angular component "my-ui", what's the Custom UI component? {<app-my-ui><app-my-ui>}?
I want to create a CustomContent for popup. I have an Angular component "my-popup". Is it right?
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.
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?
I have resolved this problem.