`Angularjs` 使用 `PARAMETERS` 调用 `WebMethod`

`Angularjs` call to `WebMethod` with `PARAMETERS`

如何使用 angularjs.

将 post 参数转换为 [WebMethod]

我的 angularjs 脚本是::

app.factory('checkAvabService', function ($http) {
    return {
        checkFare: function () {
            return $http.post('onewaydomflt.aspx/checkAvab', { 

             data:{test:"hello"} //post test as parameter to web method

          })
        }
    };
});

我的网络方法是::

[System.Web.Services.WebMethod]
public static string checkAvab(string test)  // string test is not accept value "hello"
{
    string x = test;
    return x;
}

这里我不是获取test参数值helloWebMethod.

这段代码有什么问题。

只需在 $http.post 调用的第二个参数中传递数据,该调用采用 JSON 格式的数据。您传递的对象中无需再次使用 data

return $http.post('onewaydomflt.aspx/checkAvab', {test:"hello"})