0
基于此解决方案here,我致力于能够从节点服务器接收回应。角度控制器向/从Nodejs服务器发送和接收数据
角控制器
$scope.loginUser = function() {
$scope.statusMsg = 'Sending data to server...';
$http({
url: 'http://##.##.##.##/login',
method: 'POST',
data: user,
headers: {'Content-Type': 'application/json'}
})
}
服务器的NodeJS
app.post('/login', function(req, res) {
console.log('Processing request...');
res.sendFile('/success.html');
});
怎么能这个例子可以扩展到能够接收响应从服务器返回?