Sunday 30 April 2017

How to send request body from controller and receive in server using angulrajs?

I am using AngularJs I send req.body form controller to server and get req.body but I get an error:

Cannot read property 'CHKPWD' of undefined

Code:

var checkuserpassword = 123;
var CurrentPWD = 123;

$http.post('/Header/ChangeCheckPassword', {
    'CHKPWD': checkuserpassword ,
    'CURRENTPWD':CurrentPWD
}).then(function (response) {});

Server

exports.postcheckpwd = (req, res) => {

    var checkuserpwd : req.body.CHKPWD;
    var currentpassword: req.body.CURRENTPWD;

console.log(checkuserpwd );
console.log(currentpassword);
}



via jose

No comments:

Post a Comment