Assume I have an Angular (6+) component like the following:
@Component({
selector: 'my-component',
template: '{{test}}'
})
export class MyComponent {
test = 'myData';
constructor() {}
get myData(): string {
return 'this is what I want so see in the template';
}
}
This is a very simplistic view of what I'm trying to achieve, but basically, if my template was {{myData}} I would see my getter function being called and output the expected string. But if the getter function name to be called is held in another variable in the component (imagine in my real world scenario that I have an array of these), is there a way to tell Angular to call the respective getter whose name is held by the variable test above?