.net angular js 1.5.8中bindind json respone数组时浏览器中的根作用域异常处理程序
响应即将到来,但在绑定作用域时,此行在浏览器根作用域异常中引发错误 //////征税.net angular js 1.5.8中bindind json respone数组时浏览器中的根作用域异常处理程序,.net,angularjs,model-view-controller,.net,Angularjs,Model View Controller,响应即将到来,但在绑定作用域时,此行在浏览器根作用域异常中引发错误 //////征税 $scope.BindTax = function () { debugger;`enter code here` $http({ url: 'Bindtaxdetails', method: "GET", datatype: 'json', }).then(function (response) { $scope.lst
$scope.BindTax = function () {
debugger;`enter code here`
$http({
url: 'Bindtaxdetails',
method: "GET",
datatype: 'json',
}).then(function (response) {
$scope.lst_taxdetails = response.data;
})
}
对$http服务进行故障排除
要记录任何错误消息,请添加.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服务配置的属性。有关详细信息,请参阅
通过使用
angular.js
库而不是angular.min.js
可以获得更好的错误消息。请共享视图文件好吗?当您在视图文件中使用lst_taxdetails时?