简体   繁体   English

如何使用Angularjs $ http发布状态错误

[英]How to Post Status Error Using Angularjs $http

I'm new at angular. 我是个新人。

i want to post the error message from my server, such as: 我想从我的服务器发布错误消息,例如:

在此输入图像描述

Using angularJS, and this is my code: 使用angularJS,这是我的代码:

OwnerList.batch(obArr,function(ob){
            return OwnerList.createItem(cleanOb(ob));
        },4).then(function(){
            $scope.Loading = false;
        },function(response){
            // error function
            console.log(response);
            alert('')
        },function(progress){
            $scope.OwnerListProgress = parseInt(progress * 100);
        });

so what do i need to put on error function? 那么我需要把错误功能放在什么位置呢? thanks. 谢谢。

你可以简单地做(我假设.batch是由$http / $resource制作的ajax)

alert(response.data.message.value)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM