Angularjs 从角度传递参数';s$http到python tornado服务器

Angularjs 从角度传递参数';s$http到python tornado服务器,angularjs,list,http,parameter-passing,tornado,Angularjs,List,Http,Parameter Passing,Tornado,我正在尝试将变量从前端传递到后端。这是我的密码 // JS var columns = ["col_A", "col_B", "col_C"]; var url = "working url, I confirmed it hits the server before I tried passing parameters"; var req = { method: "GET", headers: { 'Content-Type': undefined },

我正在尝试将变量从前端传递到后端。这是我的密码

// JS
var columns = ["col_A", "col_B", "col_C"];
var url = "working url, I confirmed it hits the server before I tried passing parameters";
var req = {
    method: "GET",
    headers: {
        'Content-Type': undefined
    },
    data: {
        "columns": columns
    }
}
return $http.get(url, req);

/*
    I also tried

    var req = {
        url: url,
        method: "GET",
        headers: {
            'Content-Type': undefined
        },
        data: {
            "columns": columns
        }
    }
    $http.get(req);

    but got a 404 with this
*/

---------------------------------------------------------------------------------------------

## python
import tornado.web
import tornado.gen as gen

class MyRequestHandler(tornado.web.RequestHandler):

    def __init__(self, *args, **kwargs):
        super(MyRequestHandler, self).__init__(*args, **kwargs)

    @gen.coroutine
    def get(self, *args, **kwargs):
        import pdb
        pdb.set_trace()
        # ... rest of the get function


 ## later on
 http = tornado.web.Application([
     (r"/working route", MyRequestHandler, {}),
     ... etc
因此,在我的代码暂停并使用pdb.set_trace()语句进行调试后,我将查看变量。查看self.request,我看到了一些可能与我的请求相关的东西(协议、主机、头等等),但我不知道如何访问参数“columns”。我试过了


得到了404。我真的被难住了。这个设置有什么问题?我想这一定是可能的,我刚刚错过了一件非常愚蠢的事情。

在$http调用中使用参数而不是日期 这将导致为GET调用参数化数据

如果你真的在做其他事情,你可以使用“数据”

var req = {
    method: "GET",
    headers: {
        'Content-Type': undefined
    },
    params: {
        "columns": columns
    }
}

有关在GET请求中传递数据的更多详细信息,请参阅
var req = {
    method: "GET",
    headers: {
        'Content-Type': undefined
    },
    params: {
        "columns": columns
    }
}