2

When I write $http.get request, even if I provide an error handling function:

function Ctrl1($scope, $http){
 $http.get('www.blahNonexistent.com/api').
 success(
     function(data){console.log("SUCCESS");}
 ).
 error(
     function(data){console.log("ERROR");}
 )
}

AngularJs still outputs the error to the console:

enter image description here

Here is a minimal working example on JsFiddle.

Is there any way to prevent this behavior? (I don't want the use the think the site is broken, if one of the API endpoints is down)

1
  • @IanMercer Um.. that's because it actually exists :-) And returns 302 (success) status. Commented Mar 1, 2013 at 19:38

1 Answer 1

3

That's a native error message and not an angularjs error, therefore I don't think you can "disable"/prevent it.

For example, if you add the following css to your fiddle, you will get the same GET error on the console:

div {
    background-image: url("image.png");
}
Sign up to request clarification or add additional context in comments.

1 Comment

I realized this right after I posted my question haha. But it's nice to double check nonetheless. Cheers and thanks for all the fish!

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.