的所有人。 我在视图中加载数据时遇到问题。 我的控制器是
app.controller('AccountController', function(dataFactory,$scope,$http){
getResultsPage(1);
function getResultsPage(pageNumber) {
if(! $.isEmptyObject($scope.libraryTemp)){
if($.isEmptyObject($scope.searchText)){
$scope.searchText = '';
}
if($.isEmptyObject($scope.account_type)){
$scope.account_type = '';
}
dataFactory.httpRequest('/angular_project/public/accounts?search='+$scope.searchText+'&account_type='+$scope.account_type+'&page='+pageNumber).then(function(data) {
$scope.data = data.account.data;
$scope.accountType = data.account_type;
$scope.totalItems = data.account.total;
$scpoe.perpage = data.perpage;
});
}else{
dataFactory.httpRequest('/angular_project/public/accounts?page='+pageNumber).then(function(data) {
$scope.data = data.account.data;
$scope.accountType = data.account_type;
$scope.totalItems = data.account.total;
$scope.perpage = data.perpage;
console.log(data);
});
}
}
$scope.accounts_detail = function(id){
dataFactory.httpRequest('accounts_detail/'+id).then(function(data) {console.log(data);
$scope.sales_items_detail = data.sales_items_detail;
$scope.mall_roakker_detail = data.mall_roakker_detail;
$scope.transection_detail = data.transection_detail;
console.log($scope.sales_items_detail);
$scope.ddd = 'asdfasdf';
//getResultsPage(1);
});
}
});
我的第一个观点是:
<tbody>
<tr dir-paginate="value in data | itemsPerPage:perpage" total-items="totalItems">
<td>{{ $index + 1 }}</td>
<td>{{ value.name }}</td>
<td>{{ value.address }}</td>
<td>{{ value.title }}</td>
<td>{{ value.check_from }}</td>
<td>{{ value.check_to }}</td>
<td>
<button data-toggle="modal" ng-click="edit(value.id)" data-target="#edit-data" class="btn btn-primary">Edit</button>
<a href="#/accounts_detail" class="btn btn-success" ng-click="accounts_detail(value.id)">Account Detail</a>
</td>
</tr>
</tbody>
问题是,当我点击从数据库加载但未在相关视图中显示的帐户详细信息链接数据时。
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header" data-background-color="purple">
<h4 class="title">Account Detail</h4>
</div>
<div class="card-content table-responsive">
<table class="table table-bordered pagin-table">
<thead>
<tr>
<th>Name</th>
<th>Item Name</th>
<th>Rate</th>
<th>Weight</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="x in mall_roakker_detail">
<td>{{ x.name }}</td>
<td>{{ x.title }}</td>
<td>{{ x.rate }}</td>
<td>{{ x.weight }}</td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
</div>
</div>
任何人都可以帮助我。 提前致谢
答案 0 :(得分:0)
我认为你的js文件中$scope.accounts_detail = function (id){}
没有从任何地方打电话。
像
$scope.accounts_detail(id);