I am looking to integrate a web service that accepts a JSON object with two arrays in a POST request and responds with a JSON object array.
Now, I want to make a request to this service from my AngularJS application. Below is the code snippet:
wellApp.factory('Search', ['$resource',function($resource){
return $resource('/filetables/searchdata/:tagSearchInput',
{
},
{
searchData:{
method:'POST',
isArray: true,
params:{ tag: '@tagSearchInput.tag',
details: '@tagSearchInput.details'
}
}
})
}])
function myWellsCtrl($scope,$resource, Wells, Tags, Search) {
$scope.wellSearchResult = Search.searchData({tag: ["TypeOfWell"],
details: ["Vertical"]});
};
When I try this, I encounter a NullPointerException on the server side, indicating that the arguments I am passing are null.
How can I properly pass this object to ensure that the server recognizes it as an object with two arrays? I am new to AngularJS and finding it challenging to grasp the @ notation for assigning incoming parameters. Any guidance or assistance would be greatly appreciated.