[英]REST API Ajax call using angular
app.controller('AjaxController', function ($scope,$http){
$http.json('mc/rest/candidate/pddninc/list',{
params: {
callback:'JSON_CALLBACK'
}
}).
success(function (data, status, headers, config){
if(angular.isArray(data.candidateDetails)){
$scope.reports = data.candidateDetails;
}
else{
$scope.reports = [data.candidateDetails];
}
consol.log(data);
}).
error(function (data, status, headers, config){});
});
error: $http.json
is not a function. 错误: $http.json
不是函数。 I am trying to print a data using REST API with angular. 我正在尝试使用带有角度的REST API打印数据。
The method you have to call when doing a JSONP request is $http.jsonp()
. 进行JSONP请求时必须调用的方法是$http.jsonp()
。
See the documentation . 请参阅文档 。
$http.jsonp('mc/rest/candidate/pddninc/list', {
params: {
callback:'JSON_CALLBACK'
}
}).success(...)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.