响应即将发生,但在范围内绑定时,此行会在浏览器根范围异常中引发错误
//////获得税
$scope.BindTax = function () {
debugger;`enter code here`
$http({
url: 'Bindtaxdetails',
method: "GET",
datatype: 'json',
}).then(function (response) {
$scope.lst_taxdetails = response.data;
})
}
要记录任何错误消息,请添加.catch
处理程序:
$scope.BindTax = function () {
debugger;`enter code here`
$http({
url: 'Bindtaxdetails',
method: "GET",
̶d̶a̶t̶a̶t̶y̶p̶e̶:̶ ̶'̶j̶s̶o̶n̶'̶,̶
}).then(function (response) {
$scope.lst_taxdetails = response.data;
}).catch(function (errorResponse) {
console.log(errorResponse.status);
console.log(errorResponse);
throw errorResponse;
});
}
dataType
属性是jQuery AJAX库的一部分,而不是$ http服务配置的属性。有关更多信息,请参阅AngularJS $http Service API Reference - Usage。
通过使用angular.js
库而不是angular.min.js
,您将获得更好的错误消息。