Run methods after instance construct
The PostConstruct decorator set the method to be called on moment after instance construct
PostConstruct
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 updated 5 years ago