Angular: 如何通过$http.get发送对象?
Angular: How to send object through $http.get?
customerLogin 是我要发送到我的服务的对象。
我不想使用查询字符串,也不想单独使用参数。
下面是代码:
var config = {
customerLogin : { // object I intend to send
'EmailID': $scope.existingCustomer.email,
'PhoneNumber': $scope.existingCustomer.phoneNumber,
'Passkey': $scope.existingCustomer.password
}
}
$http.get(existingCustomerUrlConstant, config).
在 webapi 中,我有以下代码:
[HttpGet]
// customerLogin object i want to receive here
public CustomerLogin GetCustomer(CustomerLogin customerLogin)
{
GetCustomerDAL getCustomerDAL = new GetCustomerDAL(customerLogin);
return customerLogin;
}
此处的 customerLogin 为空。
我如何从 Angular 服务调用接收对象?
使用POST方法是正确的调用。正如我在评论中所说。
customerLogin 是我要发送到我的服务的对象。 我不想使用查询字符串,也不想单独使用参数。 下面是代码:
var config = {
customerLogin : { // object I intend to send
'EmailID': $scope.existingCustomer.email,
'PhoneNumber': $scope.existingCustomer.phoneNumber,
'Passkey': $scope.existingCustomer.password
}
}
$http.get(existingCustomerUrlConstant, config).
在 webapi 中,我有以下代码:
[HttpGet]
// customerLogin object i want to receive here
public CustomerLogin GetCustomer(CustomerLogin customerLogin)
{
GetCustomerDAL getCustomerDAL = new GetCustomerDAL(customerLogin);
return customerLogin;
}
此处的 customerLogin 为空。 我如何从 Angular 服务调用接收对象?
使用POST方法是正确的调用。正如我在评论中所说。