I am creating a client-side script to send a dictionary object type to the web api method using $http
as follows:
$scope.SearchPolicyDetails = function (data) { var searchPolicy = new Array(); searchPolicy["InsuredName"] = data.InsuredName; searchPolicy["PostalCode"] = data.PostalCode; searchPolicy["LOB"] = data.LOB; searchPolicy["AgencyName"] = data.AgencyName; searchPolicy["Symbol"] = data.Symbol; searchPolicy["PolicyNum"] = data.PolicyNum; searchPolicy["MCO"] = data.MCO; searchPolicy["expireswithin"] = data.expireswithin; searchPolicy["SortFields"] = data.SortFields; searchPolicy["SortOrder"] = data.SortOrder; $http({ url: "http://localhost:53054/api/GetPoliciesBySearch", dataType: 'json', data: searchPolicy, headers: { "Content-Type": "application/json" } }).success(function (response) { $scope.value = response; }) };
and I have this WebAPI
method:
public List<Dictionary<string,string>> GetPoliciesBySearch(Dictionary<string,string> policySearch) { return SpecializedHandler.GetAllPolicies(policySearch).IterativeResource; }
But I am not receiving the object to the method.
I am seeing this error in the chrome console :
data
straight to$http
? Also missingmethod
method
can be fine when it is missing either. Also why aren't you using an error handler?