I\'m trying to get my head around promises in JavaScript (in particular AngularJS).
I have a function in a service, let\'s call it fooService, that chec
Similar to Elo's answer, you can return an already resolved promise using the async/await syntax:
this.update = async (data_loaded) => {
if (data_loaded)
return await null; // Instead of null, you could also return something else
// like a string "Resolved" or an object { status: 200 }
else
return await OtherPromise();
}