我有ng-table页面,可以正常使用初始数据.我有一个选择框,根据所选的选项发送服务器请求,然后我将新数据转换为角度,但不用ng-table更新.
这是我的观点:
<section data-ng-controller="ReportsController">
<div class="plain-box">
<table ng-table="tableParams" show-filter="true" class="table table-striped">
<thead>
<tr>
<th ng-repeat="column in columns" ng-show="column.visible"
class="text-center sortable" ng-class="{
'sort-asc': tableParams.isSortBy(column.field, 'asc'),
'sort-desc': tableParams.isSortBy(column.field, 'desc')
}"
ng-click="tableParams.sorting(column.field, tableParams.isSortBy(column.field, 'asc') ? 'desc' : 'asc')">
{{column.title}}
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in $data">
<td ng-repeat="column in columns" sortable="column.field">
{{user[column.field]}}
</td>
</tr>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
我的控制器:
angular.module('reports').controller('ReportsController', ['$scope', '$stateParams', '$location', 'Authentication', 'Reports', '$filter', 'ngTableParams',
function($scope, $stateParams, $location, Authentication, Reports, $filter, ngTableParams ) {
$scope.reportBillingPeriod = 0;
$scope.$watch('reportBillingPeriod', function(newValue, oldValue) { …Run Code Online (Sandbox Code Playgroud)