Update:
Due to refactoring of $q this is now possible although not documented:
promise.$$state.status === 0 // pending
promise.$$state.status === 1 // resolved
promise.$$state.status === 2 // rejected
Original:
Unlike most promise libraries (Bluebird,Q, when, RSVP etc), $q does not expose a synchronous inspection API.
There is no way to achieve this from the outside.
You have to call .then
on the promise and code in that handler will run when the promise fulfills.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…