如何在AngularJs中使用参数调用restful服务
这是我在控制器中的代码:如何在AngularJs中使用参数调用restful服务,angularjs,Angularjs,这是我在控制器中的代码: I am trying to call a restfull service with a parameter . I am getting "failed to load resource: the server responded with a status of 500 (Internal Server Error)". getAvailableList是一个方法,memberId是一个请求参数。如何将memberId参数与方法一起传递?您需要将其称为:
I am trying to call a restfull service with a parameter . I am getting "failed to load resource: the server responded with a status of 500 (Internal Server Error)".
getAvailableList是一个方法,memberId是一个请求参数。如何将memberId参数与方法一起传递?您需要将其称为:
getAvailableListFromService:function() {
var MemberId = 3;
var promise = $http.post(urlBase + '/' + 'getAvailableList',MemberId)
.success(function(data){
availableList = data;
return availableList ;
})
.error(function(data){
availableList = 'error';
return availableList ;
});
return promise;
}
查看更多信息。请尝试´$http.post(urlBase++'/'++'getAvailableList',{nameofpram:MemberId})´
$http.post(urlBase + '/' + 'getAvailableList', {MemberId: MemberId})