Within the $onInit()
function, I set two web service calls to run concurrently and store their responses in variables named referencesPromise
and contactTypesPromise
. If necessary, a new method can be created for this purpose.
$onInit() {
const referencesPromise = this.ReferenceService.getMultipleReferences(this.AgentReferences)
const contactTypesPromise = this.ContactService.getContactTypes()
Promise.all([referencesPromise, contactTypesPromise]).then((responses) => {
this.references = responses[0]
this.contactTypes = responses[1]
const stateParams = this.$state.params
return this.setContactSteps()
})
}
In what way could async-await provide an alternative solution for this?