In angular, a common way to call a function when a button is clicked is to write:
<button (click)="clickFn()">Click Me!</button>
Then in another file, you'd have your clickFn() function.
My question is: if clickFn() is an asynchronous function, does it need to be called differently in order for the browser to interpret it as an asynchronous function, or is it automatically called as an async function?
I've looked around in the angular docs and on stack overflow, but couldn't find anything on this question.
Edit:
Sure @mikeone, there are many example calls you might want to run for a button. In my project, one feature we have is allowing the user to edit their username. This needs to be asynchronous because we are sending a POST request to a database with the user's updated name and then making sure it has been received and updated before continuing. We may use a promise for this like so:
(In component.ts)
async changeUsername(updatedName: string){
await new Promise((res,rej)=>{
// * make call to database and then resolve with code 200
...
res(200)
})
}