It is not a good practice to write function calls for computing values inside the templates.
Angular will run your function in each of it's change detection cycle (which is quite frequent) and if the function is a complex one, this will impose a serious effect on the performance.
Bad:
<tr *ngFor="let user of users"> {{ someFunction(user)}} </tr>
Good:
Creating a property in the ts file and setting the value to it once.
this.users = this.users.map(user => ({ ...users, firstname: someFunction(user) });
Better:
Angular Pipes – A pure pipe is a pipe that will always return the same output for an input. Angular executes a pure pipe only when it detects a pure change to the input value because it already knows that the pipe will return the same value for the same input.
@Pipe({ name: 'examplepipe', pure: true }) export class ExamplePipe implements PipeTransform { transform(value: any, args?: any): any { // code here } }