Skip to content

Instantly share code, notes, and snippets.

@mirmostafa
Last active September 9, 2021 17:49
Show Gist options
  • Select an option

  • Save mirmostafa/acaa21a44c65d568eccdf63eec377f09 to your computer and use it in GitHub Desktop.

Select an option

Save mirmostafa/acaa21a44c65d568eccdf63eec377f09 to your computer and use it in GitHub Desktop.
How to use async/await in Typescript
##def:
private getMerchantConfigData() {
return new Promise((resolve, reject) => {
this.configService.get().subscribe(res => {
this.merchantConfigData = res;
resolve(true);
});
})
}
##use:
await this.getMerchantConfigData();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment