how to use await in angular function code example
Example 1: "when.promise" async await
/* Promise */const promiseFunction = () => { ... return somePromiseFunction();}/* async/await */const asyncFunction = async () => { ... return await somePromiseFunction();}
Example 2: "when.promise" async await
/* Promise */somePromiseFunction() .catch(error => handlerErrorFunction(error)) .then(() => doSomethingFunction());/* async/await */try { await somePromiseFunction();} catch (error) { handleErrorFunction(error);} finally { doSomethingFunction();}