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);
}
I want to call the above methods using angularJS script... I tried httpget() with param:
$http({ url: yourURL, method: "GET", params: {: params:" ''} });
What's the concrete problem? If you do it like this, it should work just fine:
$http({
url: "http://yourURL/GetEmployeeA",
method: "GET",
params: {id: 123}
});
resp.
$http({
url: "http://yourURL/GetEmployeeJSON",
method: "GET",
params: {str: 'foo'}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.