如何从导出的google工作表中的JSON ULR获取标题和超链接数据

如何从导出的google工作表中的JSON ULR获取标题和超链接数据,json,angularjs,search,filter,Json,Angularjs,Search,Filter,我能够从G-sheet中获取数据并显示,但我的要求是显示工作表名称和超链接。工作表名称不应通过搜索进行筛选。它应始终仅显示应筛选的数据 JSON提要UEL中的超链接单元格数据信息类似于“gsx$topic”:{“$t”:“全球受众覆盖率数据”},“gsx$response”:{“$t”:“Verizon Media全球产品组合工具包(内部备忘单)”},“gsx$_cre1l”:{“$t”:” 标题信息存储在JSON提要url中,如下所示。 “title”:{“type”:“text”,“$t”:

我能够从G-sheet中获取数据并显示,但我的要求是显示工作表名称和超链接。工作表名称不应通过搜索进行筛选。它应始终仅显示应筛选的数据

JSON提要UEL中的超链接单元格数据信息类似于“gsx$topic”:{“$t”:“全球受众覆盖率数据”},“gsx$response”:{“$t”:“Verizon Media全球产品组合工具包(内部备忘单)”},“gsx$_cre1l”:{“$t”:”

标题信息存储在JSON提要url中,如下所示。 “title”:{“type”:“text”,“$t”:“Data”}

您可以在下面找到我的示例代码



问题: 回应 {{user.gsx$topic.$t} {{user.gsx$response.$t} angular.module('sample',[])。 控制器('sampleController',['$scope','$http',函数($scope,$http){ 变量url=”https://spreadsheets.google.com/feeds/list/153Obe1TdWlIPyveZoNxEw53rdrghHsiWU9l-WgGwCrE/1/public/values?alt=json"; //变量url2=”https://spreadsheets.google.com/feeds/list/153Obe1TdWlIPyveZoNxEw53rdrghHsiWU9l-WgGwCrE/2/public/values?alt=json"; $http.get(url) .success(函数(数据、状态、标题、配置){ $scope.users=data.feed.entry; log($scope.users); }) .error(函数(错误、状态、标题、配置){ 控制台日志(状态); console.log(“发生错误”); }); $scope.search=''; $scope.searchFilter=函数(项){ if(item.gsx$topic.$t.indexOf($scope.search)!=-1 | | item.gsx$response.$t.indexOf($scope.search)!=-1){ 返回true; } 返回false; } }]);
您的
searchFilter()
函数仅在
gsx$topic.$t
gsx$response.$t
属性中进行搜索,因此,现在,您需要在视图中显示
标题
和hiperlink(
)属性

然后,在代码中使用:

  • user.link[0]。href
    显示链接
  • user.title.$t
    显示标题
  • 大概是这样的:

    (函数(){
    angular.module('sample',[])。
    控制器('sampleController',['$scope','$http',函数($scope,$http){
    变量url=”https://spreadsheets.google.com/feeds/list/153Obe1TdWlIPyveZoNxEw53rdrghHsiWU9l-WgGwCrE/od6/public/values?alt=json";
    $http.get(url)
    .success(函数(数据、状态、标题、配置){
    $scope.users=data.feed.entry;
    })
    .error(函数(错误、状态、标题、配置){
    控制台日志(状态);
    console.log(“发生错误”);
    });
    $scope.search='';
    $scope.searchFilter=函数(项){
    if(item.gsx$topic.$t.indexOf($scope.search)!=-1 | | item.gsx$response.$t.indexOf($scope.search)!=-1){
    返回true;
    }
    返回false;
    }
    }]);
    }());
    .view,
    .查看tbody td{
    边框:#b9b9b9实心1px;
    }
    .查看地图{
    边框样式:无;
    字体大小:粗体;
    文本对齐:居中;
    }
    .查看tbody td{
    空白:预包装;
    }
    .视图.thead th.标题{
    宽度:10%;
    }
    .查看第四个问题{
    宽度:20%;
    }
    .查看AD th.响应{
    宽度:70%;
    }
    
    


    标题 问题: 回应 {{user.gsx$topic.$t} {{user.gsx$response.$t}
    有人能帮我吗?感谢这里的帮助,我实际上希望让工作表名称显示为sheet1,当该工作表中出现搜索结果时,只显示工作表名称。在json提要url中,它类似于“title”:{“type”:“text”,“$t”:“sheet1”}。因为我的最终要求是显示多张图纸数据,且图纸名称作为标题[即图纸名称],并且仅当我们过滤时图纸中存在数据时,才应显示这些数据。
    you can find my sample code below
    
    <div ng-app="sample" ng-controller="sampleController">        
        <div class="black">      
            <input type="text" name="search" ng-model="search"
                   placeholder="search" ng-click="didSelectLanguage()"/>          
        </div>
        <br>
        <br>
        <br>
      <table  style="border: 1px solid black ;">
        <tbody>
            <tr>
                <td><center><b>Question</b></center></td>
                <td ><center><b>Response</b></center></td>
            </tr>
          <tr ng-repeat="user in users | filter:searchFilter">
            <td style="border: 1px solid black ; width:30%;white-space: pre-wrap;">{{user.gsx$topic.$t}}</td>
            <td style="border: 1px solid black ; width:70%;white-space: pre-wrap;">{{user.gsx$response.$t}}</td>
          </tr>
        </tbody>
      </table>
    </div>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
    <script>
    angular.module('sample', []).
     controller('sampleController', ['$scope', '$http', function ($scope, $http) {              
        var url = "https://spreadsheets.google.com/feeds/list/153Obe1TdWlIPyveZoNxEw53rdrghHsiWU9l-WgGwCrE/1/public/values?alt=json";
    // var url2 = "https://spreadsheets.google.com/feeds/list/153Obe1TdWlIPyveZoNxEw53rdrghHsiWU9l-WgGwCrE/2/public/values?alt=json";
        $http.get(url)
        .success(function(data, status, headers, config) {     
             $scope.users = data.feed.entry;
             console.log($scope.users);
        })
        .error(function(error, status, headers, config) {
             console.log(status);
             console.log("Error occured");
        }); 
        $scope.search='';
        $scope.searchFilter=function(item){
            if(item.gsx$topic.$t.indexOf($scope.search) != -1 || item.gsx$response.$t.indexOf($scope.search) != -1){
            return true;
                }
          return false;
        }
    
    }]);
    </script>