Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何在服务器nodejs响应中查看角度表单字段?_Angularjs_Node.js - Fatal编程技术网

Angularjs 如何在服务器nodejs响应中查看角度表单字段?

Angularjs 如何在服务器nodejs响应中查看角度表单字段?,angularjs,node.js,Angularjs,Node.js,我是新手。在这里,我尝试使用节点服务器发布角度表单 Here is my code in register.js $scope.sendForm = function() { alert("form is good"); $scope.fileds= $scope.data; var posting = $http({ method: 'POST',

我是新手。在这里,我尝试使用节点服务器发布角度表单

Here is my code 
in register.js
    $scope.sendForm = function() {
        alert("form is good");

              $scope.fileds= $scope.data;

                var posting = $http({
                    method: 'POST',
                    /*posting to /post */
                    url: '/post',
                    data: $scope.data,

                    processData: false
                })
                posting.success(function (response) {
                    /*executed when server responds back*/
                    console.log(response); 
                    $scope.response.data = response;

                });

  };
而且

app.js server side 

app.use(express.static(path.join(__dirname, 'public')));
 app.use(bodyParser());
 app.post('/post', function (req, res) {
     console.log(req.body);
    res.setHeader('Content-Type', 'application/json');
     req.body.serverMessage = "This is response from server"
     res.end(JSON.stringify(req.body));
 });
我可以看到response.data,因为这是来自表单上服务器的响应。 但我如何能得到文件和他们的价值观张贴从表单上提交的角度形式

有人能告诉我吗?

使用

  • 使用npm安装-g节点检查器安装节点检查器
  • 通过在shell选项卡中运行
    节点检查器
    启动节点检查器
  • 使用
    node--debug app.js
    在调试模式下启动节点应用程序(我建议在检测到更改时使用以重新启动进程)
  • 将浏览器指向节点检查器提供的URL
  • 在应用程序中,使用调试器语句暂停代码

     app.post('/post', function (req, res) {
       debugger;
       res.setHeader('Content-Type', 'application/json');
       req.body.serverMessage = "This is response from server"
       res.end(JSON.stringify(req.body));
     });
    
    一旦到达该端点,您就可以检查请求并使用javascript控制台。如果您熟悉Chrome开发工具,那么您会非常熟悉它