I have a front-end app in Angular and back-end in Rails. I totally decoupled those two for sake of easy maintenance.
In my backend in Rails, I have a model called Document with three different params (User_id(integer), Data(json), Title(string)). In my front end, I have a variable called formData
which is json data living in localStorage
in Angular. I'm not sure whether I'm writing the code correctly to send formData
as a parameter in HTTP request below.
Here is the request I have:
$http.post('http://localhost:3000/documents', { user: $scope.user, formData: $scope.formData }, function (response) {
$scope.isSaved = true;
console.log(response);
if (response.success) {
console.log("It has been successfully saved!")
}
});
The origin I'm sending the request is http://localhost:3001/i129
. From this website, I need to extract the document title where user is at (which is i129) and User_ID. How do I do that?
Am I send formData
correctly above? Let's say