Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access $httpPromise for POST request #83

Open
adsahay opened this issue Jan 7, 2016 · 3 comments
Open

Unable to access $httpPromise for POST request #83

adsahay opened this issue Jan 7, 2016 · 3 comments
Labels

Comments

@adsahay
Copy link

adsahay commented Jan 7, 2016

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?

@adsahay
Copy link
Author

adsahay commented Jan 14, 2016

bump

@felippenardi
Copy link

@demands Hey there :) Is there a reason why $httpPromise is not available on POST requests?

@hazeledmands
Copy link
Contributor

Ah, thanks for bumping again, @felippenardi.
This definitely looks like a bug -- PRs (either failing tests or fixes) gladly accepted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants