-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
area: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common packagefeatureIssue that requests a new featureIssue that requests a new featurestate: Needs Design
Description
There are cases where we've got a reference to a TemplateRef and would like to use it to stamp out live HTML fragments. Currently it can be easily done from the JS side (viewContainerRef.createEmbeddedView(tplRef)) but this issue is about creating a directive that would allow us to do this "inserting" from a template.
A "workish" example of such directive:
@Directive({
selector: 'ng-insert-tpl'
})
export class NgInsertTpl {
constructor(private _viewContainerRef: ViewContainerRef) {
}
@Input() set template(tplRef: TemplateRef) {
this._viewContainerRef.createEmbeddedView(tplRef);
}
}Naming things is hard so ng-insert-tpl is definitively up to debate.
This is part of #7546 (comment), it could be used in action like so: http://plnkr.co/edit/sleVVrgqo66JN9G48yyj?p=preview
Metadata
Metadata
Assignees
Labels
area: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common packagefeatureIssue that requests a new featureIssue that requests a new featurestate: Needs Design