我可以用超链接和样式在G-sheets中获取数据并使用JSON url显示吗
//var url=“”; 但数据是简单的,其中没有样式和超链接数据。如何导出图纸以获取样式和超链接。 是否可以从发布的HTML url读取数据,并使用JSON应用过滤器。请建议我可以用超链接和样式在G-sheets中获取数据并使用JSON url显示吗,json,angularjs,search,Json,Angularjs,Search,//var url=“”; 但数据是简单的,其中没有样式和超链接数据。如何导出图纸以获取样式和超链接。 是否可以从发布的HTML url读取数据,并使用JSON应用过滤器。请建议 I have used below url to export the G-sheet data as a JSON feed and fetched data using gsx$topic.$t 示例代码: 问题: 回应 {{user.gsx$topic.$t} {{user.gsx$response.$t
I have used below url to export the G-sheet data as a JSON feed and fetched data using gsx$topic.$t
示例代码:
问题:
回应
{{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;
}
}]);
但在您共享的资源(URL)中,没有与超链接和应用样式相关的元数据。是的,您是对的,但我们如何准备可以包含超链接和样式的资源URL。你能帮帮我吗。与发布HTMl URL类似,ng bind的这段代码帮助我解决了这个问题。var url=/(\b(https?| ftp):\/\/[A-Z0-9+&@#\/%?=~|!:,.;-]*[-A-Z0-9+&@#\/%=~|]/gim;如果(text.match(url)){//要用超链接替换所有url,返回$sce.trustAsHtml(text.replace(url,”);}现在我需要样式方面的帮助,但不是通过json url提供的。我找到了一些可以为您提供正确方法的链接:这:。
sample code :
<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>