An interesting question arose.
There is a component that listens for a subject like:
export interface ToolPanel {
title ?: string;
buttons: Button [];
}
And then it just displays the buttons in the ngFor template.
Now you need to add the ability to display select list or textarea under the buttons?
How to properly extend the functionality of a component (template)?
Template is:
<div class="row" *ngFor="let tool of tools.toolPanels$">
{{tool.title}}
<!-- Here can be input, select or textarea -->
</div>
I think to extend the interface:
export interface ToolPanel {
title ?: string;
buttons: Button [];
type: 'formField'
}
Then check in template:
<div class="row" *ngFor="let tool of tools.toolPanels$">
{{tool.title}}
<div *ngIf="tool.type === 'formField'">
<app-formfield [type]="tool.type"></formfield>
</div>
</div>