小编Yoa*_*adi的帖子

使用google工作表API时Angular 1.6 $ http.jsonp

Angular 1.6的$ http.jsonp与google sheet的API不太搭配:

我正在尝试从谷歌工作表中获取并获取我的数据,具体如下:

var callback;
app.controller("meetingsTable", function ($scope, $http, $sce) {

var url = "http://spreadsheets.google.com/a/google.com/tq";
var trustedUrl = $sce.trustAsResourceUrl(url);
var key = 'MY_KEY';
var tq = 'select%20*%20limit%2010';
var tqx = 'responseHandler:callback';
var params = {
    key: key,
    tq: tq,
    status: 'ok',
    tqx: tqx
};

callback = function (response) {
    console.log(response); // entering here, not to the promise
    return response;
}


    $http.jsonp(trustedUrl, { params: params }).then(function (response) {
        console.log(response);
        retrun;
        //success things go here
    }, function (response) {
        //error …
Run Code Online (Sandbox Code Playgroud)

javascript jsonp angularjs angular-promise google-sheets-api

6
推荐指数
1
解决办法
434
查看次数