Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用AngularJS$http.post将对象传递到.Net asmx_.net_Angularjs_Vb.net_Web Services_Asmx - Fatal编程技术网

使用AngularJS$http.post将对象传递到.Net asmx

使用AngularJS$http.post将对象传递到.Net asmx,.net,angularjs,vb.net,web-services,asmx,.net,Angularjs,Vb.net,Web Services,Asmx,因此,我试图将javascript对象从$http.post传递到.NETWeb服务。我已经为另一个类似这样的web方法工作了 var GetLeadTimeline = function($http,idLead){return $http.post('/admin/leads/LeadUpdates.asmx/GetLeadTimeline', {idLead: idLead});}; 但该方法只接受一个整数作为id 我现在想接收一个对象。 我犯了500个错误,有人能告诉我一个方向来说明我

因此,我试图将javascript对象从$http.post传递到.NETWeb服务。我已经为另一个类似这样的web方法工作了

var GetLeadTimeline = function($http,idLead){return $http.post('/admin/leads/LeadUpdates.asmx/GetLeadTimeline', {idLead: idLead});};
但该方法只接受一个整数作为id

我现在想接收一个对象。 我犯了500个错误,有人能告诉我一个方向来说明我做错了什么吗

模板中的代码

<button id="btnAddReminder" data-id="" data-name="" type="button" class="btn btn-primary" ng-click="AddNewReminder(l.idLead, l.FirstName + l.LastName)">
AngularJS-服务

 myLeadDashboard.factory('LeadsServiceTest',[function(){
        var UpdateReminder = function($http,dataObj){return $http.post('/admin/leads/LeadUpdates.asmx/AddReminder', dataObj);};
        return {
            UpdateReminder:UpdateReminder                
        };
    }]);
.Net对象类

 Public Class ReminderFields
    Public ReminderContent As String = ""
    Public ReminderDT As String = ""
    Public idLead As Integer = 0
End Class
.Net方法

 <WebMethod(EnableSession:=True)> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True, XmlSerializeString:=False)>
Public Function AddReminder(ByVal value As ReminderFields) As UpdateResponse
    Dim response As New RemindersResponse
    Dim NewNotifcation As New Agent.Notifications
    NewNotifcation.Subject = value.ReminderContent
    NewNotifcation.TimeStamp = CDate(value.ReminderDT).ToUniversalTime.Subtract(#1/1/1970#).TotalSeconds
    NewNotifcation.idLead = value.idLead
    NewNotifcation.idNotification = 0
    NewNotifcation.Save()
    response.Success = True
    Return response
End Function
_
作为更新响应的公共函数AddReminder(作为提醒字段的ByVal值)
Dim响应作为新的提醒响应
Dim NewNotification作为新代理。通知
newnotification.Subject=value.rementercontent
newnotification.TimeStamp=CDate(value.remenderdt).ToUniversalTime.Subtract(#1/1/1970#)。TotalSeconds
newnotification.idLead=value.idLead
newnotification.idNotification=0
newnotification.Save()
回答:成功=True
返回响应
端函数

如何将其备份?我应该设置赏金吗?您使用
$http.post
,并且您的方法声明使用
HttpGet:=True
。当您删除
HttpGet:=True
或将其设置为false时会发生什么情况?我删除了它,并且对象出现了问题。我最后只是像这样传递数据公共函数AddReminder(ReminderContent作为字符串,ReminderDT作为字符串,idLead作为字符串)作为UpdateResponse
 <WebMethod(EnableSession:=True)> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True, XmlSerializeString:=False)>
Public Function AddReminder(ByVal value As ReminderFields) As UpdateResponse
    Dim response As New RemindersResponse
    Dim NewNotifcation As New Agent.Notifications
    NewNotifcation.Subject = value.ReminderContent
    NewNotifcation.TimeStamp = CDate(value.ReminderDT).ToUniversalTime.Subtract(#1/1/1970#).TotalSeconds
    NewNotifcation.idLead = value.idLead
    NewNotifcation.idNotification = 0
    NewNotifcation.Save()
    response.Success = True
    Return response
End Function