我尝试在远程数据上使用智能表,但我没有得到任何输出。我一直在阅读有关 ajax 数据应该使用 stSafeSrc 属性的文档,但显然我做错了。
我的标记如下所示
<div class="content">
<div class="container">
{% verbatim %}
{{ rowCollection }}
<button type="button" ng-click="addRandomItem(row)" class="btn btn-sm btn-success">
<i class="glyphicon glyphicon-plus"></i> Add Feed
</button>
<table st-table="displayedCollection" st-safe-src="rowCollection" class="table table-striped">
<thead>
<tr>
<th>Feed Name</th>
<th>parsed Items</th>
<th>Feed Link</th>
<th>Feed Type</th>
<th>Import</th>
<th>Categorize</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in displayedCollection">
<td>{{row.feed_type}}</td>
<td>{{ row.id }}</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
{% endverbatim %}
</div>
</div>
控制器
october.controllers['dashboard/feeds'] = function ($scope, $filter , $request) {
$.request('onFeeds', {success: function(data, scope){
this.success(data).done(function() {
$scope.rowCollection = [];
$scope.rowCollection = angular.fromJson(data.result);
$scope.displayedCollection = [].concat($scope.rowCollection);
console.log($scope.rowCollection); // Array of Objects is present
});
}
});
}