API to retrieve promise state
Right now $q promises don't have any way to get their state (pending, fulfilled, rejected). There's ajoslin/angular-promise-tracker that will keep track of $q promises for you but it really seems overkill to have such a project simply because there's no way to get $q promise states.
Would suggest something like Q has with isFulfilled(), isRejected() and isPending().
@cgross, as was mentioned, you can reference the $$state variable --- it's private, but it probably isn't going anywhere since we can't use symbols in 1.x.
One thing you could do is put together a module which monkeypatches these methods onto the promise prototype.
Why is this closed? Either $q should be updated or at least the documentation should make it crystal clear that it's only a subset of Q.
The documentation to $q starts with
This is an implementation of promises/deferred objects inspired by Kris Kowal's Q.
and links to his project. For me and probably many other people means "Yeah, we took his API and some of his code and adapted it to angular". It definitively doesn't read like "We implemented three methods and were done". So can we either get the full Q API (which would also make $q promises compatible with anything that works with Q) or at least add a sentence that makes the difference clear?
Is it possible without using $$state, to determine if a $http error is triggered by a resolved timeout promise or not.
Please re-open this issue since it's not fixed and the $$state "workaround" is not acceptable.
I'll add myself to the list of people that would like to have the possibility to check promise state synchronously as it can be done in Q or similar libraries. There are situations when this functionality can be extremely useful and a lot cleaner to use than some .finally implementation.
For example, I stumbled on this issue while writing a queue service for several async operations that should run in parallel or serialized (and a mix of the two) based on different resource type being operated upon.
While I agree that this could lead to plenty of antipatterns from less experienced developers, right now there is no guaranteed way for me to reliably check on the status of a Promise to report async operations back to the user. It's more trouble than it's worth to have a promise update a scope/controller variable through watches or .then() callbacks when we could just plop promise.inspect().state === 'resolved' or promise.isResolved() into a template.