@PostConstruct()

Last updated 2 months ago

Run methods after instance construct

Overview

The PostConstruct decorator set the method to be called on moment after instance construct

Example

‚Äč

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}`;
}
}