-
First,define the primary-button component,like this:
Then,use the component like this,
The question is how to render the component's content in the controller? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I'm not sure of the question. Do you mean you want to wrap what the children of the tag into your button? if so you can get the initial content with @controller
export class PrimaryButtonElement extends HTMLElement {
connectedCallback(){
const initialContent = this.innerHTML;
const itemTemplate = (content:string) => {
return html`<button>${content}???</button>`
}
this.innerHTML=''
render(itemTemplate(initialContent), this);
}
} You will have to get rid of it and re-render it again. <primary-button data-catalyst="">
<button>new issue???</button>
</primary-button> I hope it helps. |
Beta Was this translation helpful? Give feedback.
-
thanks a lot |
Beta Was this translation helpful? Give feedback.
I'm not sure of the question. Do you mean you want to wrap what the children of the tag into your button? if so you can get the initial content with
this.innerHTML
as a string and do it like so:You will have to get rid of it and re-render it again.
it will render:
I hop…