繁体   English   中英

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

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

我是个新人。

我想从我的服务器发布错误消息,例如:

在此输入图像描述

使用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);
        });

那么我需要把错误功能放在什么位置呢? 谢谢。

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

alert(response.data.message.value)

暂无
暂无

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

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