I need to pass an expression to a component that will be evaluated inside an component's template.
For example, component:
@Component({
selector: 'app-my-component',
...
})
export class MyComponent {
@Input items: MyClass;
@Input expression: String;
...
}
with component's template:
<div *ngFor="let item of items">
{{expression}}
</div>
Usage of MyComponent:
<app-my-component [items]="listOfItems" [expression]="'[item.id] item.name'">
</app-my-component>
As there will be more than one input, I would like to avoid usage of TemplateRef.