You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to handle a more graceful offline/timeout scenario for an app. The idea is to update the UI when a request fails with status 0 (i.e., api is offline or request timed out), and then once request is POST-ed to the server update UI with fresh data.
Here's the pseudo-code:
var a = new Article({text: 'we all try something'});
a.$save();
a.$promise.then(updateUI).catch(function(request) {
if (request.status == 0) {
// show an updated UI like "pending" status
updatePendingStatus();
}
});
// after a minute or two when the request is retried
// and submitted successfully, then update UI.
a.$httpPromise.then(updateUI);
However it seems a.$httpPromise is undefined. How do I achieve what I want?
The text was updated successfully, but these errors were encountered:
I'm trying to handle a more graceful offline/timeout scenario for an app. The idea is to update the UI when a request fails with status 0 (i.e., api is offline or request timed out), and then once request is POST-ed to the server update UI with fresh data.
Here's the pseudo-code:
However it seems
a.$httpPromise
isundefined
. How do I achieve what I want?The text was updated successfully, but these errors were encountered: