0

What is the simplest way to call $httpBackend manually?

Yes, I am aware that you are supposed to use $http instead, however this is a special use case: I am augmenting the $exceptionHandler and want to send a log message back to the server, however I can't use $http since it will trigger an $apply which could retrigger an exception causing an infinite loop and locking up the browser.

Most examples (and my own code) has used jQuery to issue the Ajax call to log the error. I'm trying to solve it with out using jQuery.

1 Answer 1

0

Warning this is an undocumented API on purpose and I'm certain the Angular team reserves the right to change the signature.

That being said here is the minimal backend call I've been able to create:

$httpBackend('POST', '/some/url',          //method and url
    JSON.stringify(buildLogInfo()),        //request body
    function(status,resp,headerString){    //response call back
        console.log('manual backend call',status,resp,headerString);
    },
    {"Content-Type": "application/json"}   //request headers
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.