Okay I was able to solve my problem. I failed to realize that I can use the following syntax myself:
*ngFor="let test...."
With this I was able to create the following directive:
import { Directive, TemplateRef, ViewContainerRef } from '@angular/core';
@Directive({
selector: '[appWrapper]',
})
export class WrapperDirective {
constructor(viewContainer: ViewContainerRef, template: TemplateRef<any>) {
viewContainer.createEmbeddedView(
template,
{ ['$implicit']: 'Max Mustermann' },
0,
);
}
}
This directive can now be used like this:
<div *appWrapper="let name">{{ name }}</div>
Is there a way to get rid of the let name part?
This Stackoverflow post helped me to implement my idea