right now I have this form:
<form ng-submit = submit()ng-controller = formCtrl>
<input ng-model=formData.stickie type=text id=sticky_content />
<button type=submit id=add_sticky value=add a new stickie!>new sticky</button>
</form>
controlled by this model:
app.controller('formCtrl',function($scope,$http){
$scope.submit = function() {
$http.post('/api/stickies', $scope.formData)
**** somehow assign data to something useable by the function below???******
})
.error(function(data){
console.log('Error: ' + data);
});
};
});
and I want to be able to use the posted data in here:
app.post('/api/stickies',function(req,res){
var test = formData.stickie; //returns undefined for sticky and for formData.stickie
db.run(INSERT INTO stickies (data) VALUES (?), [ test ]);
});
so in summary, I am trying to pass the $scope.formData variable into my server.js file so that it can be used in my app.post function (and inserted into the db)
Edit: updated code in accordance with answer given below: currently getting `ReferenceError: formData is not Defined, when I submit the form.