Skip to content

Pipe for converting string to template reference #30294

Closed
@RakeshMaddala

Description

@RakeshMaddala

🚀 feature request

Relevant Package

This feature request is for @angular/common

Description

If we need to use

[ngTemplateOutlet]="templateName"
The "templateName" should be defined in component and should be of type TemplateRef.

Problem described with an example here - https://stackoverflow.com/questions/56001849/how-to-convert-string-to-an-template-reference-instance

Describe the solution you'd like

I should be able to convert the string type from a property to templateRef type using a pipe like below

[ngTemplateOutlet]="templateName | templateRef"
In this case templateName can be string.

Describe alternatives you've considered

Here is the current alternative to the problem described above.
https://stackblitz.com/edit/ng-template-outlet-mhpnas?file=app/app.component.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimefeatureIssue that requests a new featurefeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsfeature: votes requiredFeature request which is currently still in the voting phase

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions