0 votes
in Angular by
What is the process of inserting an embedded view from a prepared TemplateRef?

1 Answer

0 votes
by
@Component({

    selector: 'app-root',

    template: `

        <ng-template #template let-name='fromContext'><div>{{name}}</ng-template>

    `

})

export class AppComponent implements AfterViewChecked {

    @ViewChild('template', { read: TemplateRef }) _template: TemplateRef<any>;

    constructor() { }

    ngAfterViewChecked() {

        this.vc.createEmbeddedView(this._template, {fromContext: 'John'});

    }

}

Related questions

0 votes
asked Dec 15, 2023 in Angular by AdilsonLima
0 votes
asked Dec 3, 2021 in Cloud Computing by DavidAnderson
...