请问angularJS $http请求失败的时候为什么不会执行errorCallback方法?

图片说明
$http({
method: 'POST',
url: ipAdress,
data: "{}",
headers: { 'content-type': 'application/json'}
}).then(function successCallback(response){
console.log(response);
}),function errorCallback(response){
console.log("err");
}


原来我把括号写错位置了,正确写法如下:
$http({
method: 'POST',
url: '/someUrl'
}).then(function successCallback(response) {
// 请求成功执行代码
}, function errorCallback(response) {
// 请求失败执行代码
});

看看后台controller函数是否有问题,我有次ajax老是执行失败的回调函数,后来发现后台返回的不是标准的json格式导致的。