Answer the question
In order to leave comments, you need to log in
How to correctly call an asynchronous method with a parameter from html markup in angular?
Angular project, there is an asynchronous method that makes a request for data by parameter
async getAddressByCode(addressCode: string) {
const address = await this.resourceService.getAddressByCode(addressCode).toPromise();
return address;
}
<span>{{getAddressByCode(addressCode)}}</span>
[object Promise]
<span>{{async getAddressByCode(addressCode)}}</span>
Answer the question
In order to leave comments, you need to log in
<span>{{ getAddressByCode(addressCode) | async }}</span>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question