@PostConstruct()
Run methods after instance construct

Overview

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

Example

1
export class AdminController {
2
public firstName:string;
3
public lastName:string;
4
public fullName:string;
5
6
constructor(firstName:string, lastName:string){
7
this.firstName = firstName;
8
this.lastName = lastName;
9
}
10
@PostConstruct()
11
generaterFullName(){
12
this.fullName = `${this.firstName} ${this.lastName}`;
13
14
}
15
}
Copied!
Last modified 2yr ago
Copy link