如何使用AngularJs中的参数调用restful service

时间:2015-12-03 22:50:00

标签: 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)".

这是我在控制器中的代码:

 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;   
        }

getAvailableList是一个方法,memberId是一个请求参数。如何传递memberId参数和方法?

1 个答案:

答案 0 :(得分:-1)

您需要将其称为:

$http.post(urlBase + '/' + 'getAvailableList', {MemberId: MemberId})

查看$http.post了解详情。