public interface IService1
{
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetEmployeeA?id={id}")]
EmployeeA GetEmployeeA(int id);
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetEmployeeJSON?str={str}")]
string GetEmployeeJSON(string str);
}
我想使用angularJS脚本调用上面的方法...我用param尝试了httpget():
$http({ url: yourURL, method: "GET", params: {: params:" ''} });
答案 0 :(得分:1)
具体问题是什么?如果你这样做,它应该工作得很好:
$http({
url: "http://yourURL/GetEmployeeA",
method: "GET",
params: {id: 123}
});
RESP。
$http({
url: "http://yourURL/GetEmployeeJSON",
method: "GET",
params: {str: 'foo'}
});