0

If we create a webcomponent in Angular, how to consume Input that takes TemplateRef?

For example the following component ist converted to a web component

@component({
selector:"app-lorem",
....
})
export class LoremComponent{

@Input()
ipsum: TemplateRef<any>

....
}

Now in react or in js App its being used as:

...imports here...

<app-lorem> </app-lorem>

<template> Hello world </template>

So the web component is working well but there ist no way to pass template to app-lorem. Moreover i think template can not be assigned to TemplateRef. Any Help here?

1 Answer 1

-1

Just pass ref to it as value

<app-lorem [ipsum]="myTemplate"> </app-lorem>

<template #myTemplate> Hello world </template>
Sign up to request clarification or add additional context in comments.

2 Comments

your suggestion is for angular environment. element ref with # works only in Angular not in react. moreover template can not passed to TemplateRef
"Angular TemplateRef in web component",so....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.