Methods must either return synchronously or return asynchronously to remain consistent. If the method sometimes returns synchronously and still wants to save the fact, then it is already resolved transparently - it returns an empty resolved promise. Having an API that sometimes returns promises, and sometimes synchronously, is a recipe for problems .
Using $q.when is the easiest way to get an empty resolved promise in Angular.
source share