我无法使用
访问控制器中的 tableview **$scope.tableview.reload()**
view.html is this.
<div class="container-fluid" ng-controller="SearchListCtrl">
<input ng-model="titleFilter"> Title Filter: {{ titleFilter }}
<table ng-table="tableview" show-filter="true" class="table-responsive table table-striped table-bordered table-condensed table-hover">
<thead>
<tr><th colspan="3">Book Shelf</th></tr>
</thead>
<tbody>
<tr ng-repeat="book in books | filter:titleFilter">
<td><a href="#/data/{{$index + 1}}" ng-click="editBook(book)" class="thumb">{{$index + 1}}</a></td>
<td class="col-sm-4">
{{book.genre}}
</td>
<td class="col-sm-4">{{book.title}}</td>
<td class="col-sm-4">{{book.author}}</td>
<td>
<button class="btn btn-danger btn-mini" ng-click="deleteRow($index)">
<i class="icon-trash icon-white"></i>
</button>
</tr>
</tbody>
</table>
控制器就是这个
librarysystemcontroller.controller('SearchListCtrl',
['$scope',
'Library',
'EditBookService',
'$http',
'$rootScope',
function($scope,
Library,
EditBookService,
$http,
$rootScope) {
$scope.tableview.reload();
}]);
@ scope.tableview未定义。这不允许吗?其他模型元素如ng-model也可以访问。
Error is this. Is there a problem with the HTML ?
TypeError: Cannot read property 'reload' of undefined
更新:我认为我目前的表格足以满足我的目的。 ng-table似乎需要 一些我不需要的配置。
答案 0 :(得分:0)
将此“ngTableParams”
librarysystemcontroller.controller('SearchListCtrl',
['$scope',
'Library',
'EditBookService',
'$http',
'$rootScope',
function($scope,
Library,
EditBookService,
$http,
$rootScope,ngTableParams) {