Tuesday 14 March 2017

Pass userinfo to NodeJs

I have a Angular form that passed the values to NodeJS. I am able to post the values present in the form. I also want to send the logged in user information to NodeJS.

My form:

<form>
<input type="text" placeholder="title" ng-model="post.title">
<input type="text" placeholder="category" ng-model="post.category">
<input type="submit" ng-click="newpost(post)">Post
</form>

Angular:

var user = $cookies.get('user');
$scope.post = function(post){
    $http.post('/newpost', post).then ...
}

How do I pass the user information along with the post to NodeJS?

Thanks.



via Somename

No comments:

Post a Comment