Ваша функция searchFilter()
выполняет поиск только в атрибутах gsx$topic.$t
и gsx$response.$t
, поэтому теперь вам нужно отобразить title
и гиперссылку (link
) атрибутов в вашем представлении.
![enter image description here](https://i.stack.imgur.com/fCiHF.png)
Затем в вашем коде используйте:
user.link[0].href
для отображения ссылки. user.title.$t
для отображения заголовка.
![enter image description here](https://i.stack.imgur.com/AzFex.png)
Примерно так:
(function() {
angular.module('sample', []).
controller('sampleController', ['$scope', '$http', function($scope, $http) {
var url = "https://spreadsheets.google.com/feeds/list/153Obe1TdWlIPyveZoNxEw53rdrghHsiWU9l-WgGwCrE/od6/public/values?alt=json";
$http.get(url)
.success(function(data, status, headers, config) {
$scope.users = data.feed.entry;
})
.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;
}
}]);
}());
.view,
.view tbody td {
border: #b9b9b9 solid 1px;
}
.view thead th {
border-style: none;
font-weight: bold;
text-align: center;
}
.view tbody td {
white-space: pre-wrap;
}
.view. thead th.title {
width: 10%;
}
.view thead th.question {
width: 20%;
}
.view thead th.response {
width: 70%;
}
<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 class="view">
<thead>
<tr>
<th class="title">Title</th>
<th class="question">Question</th>
<th class="response">Response</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in users | filter:searchFilter">
<td><a href="{{user.link[0].href}}" title="{{user.link[0].href}}">{{user.title.$t}}</a></td>
<td>{{user.gsx$topic.$t}}</td>
<td>{{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>