Javascript 如何在变量中获得400个错误请求
我已从我的REST中获得答案-结果= 我想向使用angularJS的用户显示这个错误 我有控制器的功能Javascript 如何在变量中获得400个错误请求,javascript,angularjs,Javascript,Angularjs,我已从我的REST中获得答案-结果= 我想向使用angularJS的用户显示这个错误 我有控制器的功能 $scope.update = function (id) { Topic.get({id: id}, function (result) { $scope.name = result; $('#saveTopicModal').modal('show');
$scope.update = function (id) {
Topic.get({id: id}, function (result) {
$scope.name = result;
$('#saveTopicModal').modal('show');
console.log(result);
});
};
请帮助-如何获取某些变量中的错误,然后显示此变量。
谢谢要访问错误,您必须按照angular$resource API的描述定义错误处理程序
等于
id
?id-它的intereger-.get方法
$scope.error = error;
$scope.update = function (id) {
Topic.get({id: id}, function (result) {
$scope.name = result;
$('#saveTopicModal').modal('show');
console.log(result);
}, function (error) {
console.log(error);
$scope.error = error;
});
};