Closed KahouTong closed 3 years ago
async ngOnInit(): Promise { this.descObject = {}; this.updateDesc = {}; this.postDesc = {}; await this.getCovidInit(); this.descObject = this.temp; this.getCovid(); this.getCovidDesc(); console.log("Covid Component Inited"); console.log("Total of Description Column Row --->" + this.descObject.length); }
async getCovidInit(): Promise { return this.descObject = await this.covidApiService.getCovidDesc().toPromise().then((data: any) => { this.temp = data; }); }
For further understanding: https://balramchavan.medium.com/using-async-await-feature-in-angular-587dd56fdc77
async ngOnInit(): Promise {
this.descObject = {};
this.updateDesc = {};
this.postDesc = {};
await this.getCovidInit();
this.descObject = this.temp;
this.getCovid();
this.getCovidDesc();
console.log("Covid Component Inited");
console.log("Total of Description Column Row --->" + this.descObject.length);
}
async getCovidInit(): Promise {
return this.descObject = await this.covidApiService.getCovidDesc().toPromise().then((data: any) => {
this.temp = data;
});
}
For further understanding: https://balramchavan.medium.com/using-async-await-feature-in-angular-587dd56fdc77