Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ng-template #element>
- <div style="border:solid 3px yellow;width:250px;
- height:250px;position:relative;top:0px;">
- this is my element
- </div>
- </ng-template>
- <ng-container #template>
- </ng-container>
- @ViewChild('element', { read: TemplateRef }) element: TemplateRef<any>;
- @ViewChild('template', { read: ViewContainerRef }) template: ViewContainerRef;
- ngAfterViewInit() {
- this.template.createEmbeddedView(this.element);
- }
- @ViewChild('element', { read: ElementRef }) element: ElementRef;
Add Comment
Please, Sign In to add comment