These are chat archives for codefellows/sea-b15-javascript

2nd
Oct 2014
kevin-staiger
@kevin-staiger
Oct 02 2014 05:55
Hi sorry to take over this room with angularjs questions but I'm a ruby guy struggling my way through this angular app but I am finally at the end. all i need to do is take the scope variables from my form post and put them into a parameter in my nodjs server, is there standard way to transfer scope variables to your server? I did some research and this is what I cam up with but its not working
here is my http post on my angular side
Marco Lindsay
@Marco-Lindsay
Oct 02 2014 05:55
man kevin always taking over the js room
kevin-staiger
@kevin-staiger
Oct 02 2014 05:56
  $http({
          method: "post",
            url: "/api/trigger",
            data: {names: $scope.jobName, email: $scope.email, room: $scope.room, type: $scope.types}
     }).success(function(data, response) {
                         $scope.jobName = data    
        }).error(function(response){
            console.log(response)
        });
    } else {
        alert('Not Submitted, Error Filling Out Form')
    };
};
and my server side

app.post('/api/trigger', function(req,res) {

jenkins.build('TestGitHubHook', {TEST_PARAM: req.body.names, EMAIL: req.body.email, ROOM: req.body.email, TYPE: req.body.types}, function(err, data) {
if (err){ return console.log(err); }
console.log(data)
res.json(data)
});

i thought using req.body.(json key) would work but its not, if anyone has run into this help would be very appreciated