I'm trying to dynamically insert an embedded view based on an <ng-template> to a ViewContainerRef in a base component.
That base component contains fields that are relevant to all implementations of that base component. I need extend that component by dynamically creating components/templates and inserting them into that component's view.
I've noticed that if my ViewContainerRef already contains children, then the component/view created with createComponent()/createEmbeddedView() is always inserted as the last child of the ViewContainerRef's element. I want the inserted view to be the first child of the ViewContainerRef's element.
Is there any way to achieve this besides manipulating the DOM outside of Angular?
Example app: https://stackblitz.com/edit/angular-ivy-t6ygjl