We have a custom template element that displays the header-title and we would like to extend this component to also show the header title with breadcrumbs when we have clicked on a button.
Sample code:
... private getTemplateResultFromProperty: TemplateResult[] = []; ...
//This works fine:
func1(): TemplateResult {
return html`
<custom-header-template
.data=${data}'>
</custom-header-template>`
}
//Can't return concatenated header
func2(): TemplateResult {
//repeat does not work, this returns empty strings
return html`${repeat(this.getTemplateResultFromProperty, t => t)}`;
}
We are able to return and display the new header only in the func2 method by specifying an array element without using the html`` like so: return this.headerTemplateArray[1] But that is not what we would like to do..
Error message: Uncaught (in promise) TypeError: Cannot read property 'split' of null at new Template (template.js:87) when we try this: return html`${this.getTemplateResultFromProperty}`;
The html`` approach does not seem to work for us at all in this method... So we suspect there might be a problem with either the way we use repeat() or that we are concatenate/using TemplateResult in the wrong way.
Any ideas?