@PostConstruct()
Run methods after instance construct
The
PostConstruct
decorator set the method to be called on moment after instance construct
export class AdminController {
public firstName:string;
public lastName:string;
public fullName:string;
constructor(firstName:string, lastName:string){
this.firstName = firstName;
this.lastName = lastName;
}
@PostConstruct()
generaterFullName(){
this.fullName = `${this.firstName} ${this.lastName}`;
}
}
Last modified 4yr ago