Is there a way in Angular 9 to directly call static methods from HTML without using shared services or defining methods in components? I came across an old approach on How to call static method of other class in .html (not in .ts)?, but I am curious if there is a better way now. Instead of creating a shared service with shared methods, I want to know if it's possible to call static methods directly from the HTML. How can this be achieved?
demoBase.ts:
export class DemoBase {
static demoMethod(id) {
//
}
}
I would like to invoke the above method from the HTML of another component:
list.component.ts:
import { DemoBase } from '@pages/demoBase';
//other stuff (I do not want to create a method here to access base method)
list.component.html:
<div><span [ngClass]="DemoBase.demoMethod(record.Id)">{{record.Name}}</span></div>