I wanted to ask the better approach of my calling.
lets say i have a class Human
export default class Human {
private firstname: string;
private lastname: string;
public getFirstName():string {
return this.firstname;
}
public setFirstName(val : string ) {
this.firstname = val;
}
public getLastName():string {
return this.lastname
}
public setLastName(val : string ) {
this.lastname = val;
}
public getFullName(): {
return `${this.firstname} + ' ' + ${this.lastname};
}
}
TS :
human: Human;
// below some http call which asigns human class to response...
// Response variables assigned to class variables , f.e : human.setFirstName(data.firstname)
HTML :
<h2>{{human.getName()}}</h2>
And as it seems logical, everything would be good except it calls that function on each change, each second. What is the better approach of doing the same thing ? (I dont want to have variables because back-end changes a lot and I want to have all functions there). + I must change all the variables in whole front-end app html if I use variables, with functions I only have to change function inner variable.
| asyncin the template?getandsetin typescript? typescriptlang.org/docs/handbook/classes.html#accessors