asked on
<tbody>
<tr ng-repeat="person in employee | orderBy:orderByField:reverseSort">
<td>{{person.name}}</td>
<td>{{person.age}}</td>
<td>{{person.gender}}</td>
<td>{{person.company}}</td>
<td>
<div class="btn-toolbar" role="toolbar">
<button class="btn" ng-click="viewEmployee(person.id)"><span class="glyphicon glyphicon-eye-open"></button>
<button class="btn" ng-click="editEmployee(person.id)"><span class="glyphicon glyphicon-pencil"></button>
<button class="btn" ng-click="deleteEmployee(person.id)"><span class="glyphicon glyphicon-trash"></button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td align="center" colspan="6">
<div class="pull-right">
<pagination total-items="totalCount" ng-change="pageChanged()" items-per-page="pageSizeSelected" direction-links="true" ng-model="pageIndex" max-size="maxSize" class="pagination" boundary-links="true" rotate="false" num-pages="numPages"></pagination>
<a class="btn btn-primary">Page: {{pageIndex}} / {{numPages}}</a>
</div>
</td>
</tr>
</tfoot>
scope.maxSize = 5;
scope.totalCount = 0;
scope.pageIndex = 1;
scope.pageSizeSelected = 5;
scope.init = function(){
$http({
method: 'GET',
url: "/api/v1/employee/list?pageIndex=" + scope.pageIndex + "&pageSize=" + scope.pageSizeSelected
}).then(function successCallback(response){
scope.totalCount = response.data.length;
scope.numPages = Math.ceil(scope.totalCount / scope.pageSizeSelected);
scope.employee = response.data;
});
};
scope.pageChanged = function(){
scope.init();
};
public function lsAll(){
$employee = Employee::paginate(5);
return $employee;
}
How do I handle pageIndex in laravel?Can you elaborate on this a bit more - not clear what you are asking?
ASKER
$employee = Employee::paginate(5); //pageSizeSelected
ASKER
ASKER
ASKER
<tfoot>
<tr>
<td align="center" colspan="6">
<div class="pull-right">
<pagination
total-items="totalCount"
ng-change="pageChanged()"
items-per-page="pageSizeSelected"
direction-links="true"
ng-model="pageIndex"
max-size="maxSize"
class="pagination-sm"
boundary-links="true"
rotate="false"
num-pages="numPages">
</pagination>
<a class="btn btn-primary">Page: {{pageIndex}} / {{numPages}}</a>
</div>
</td>
</tr>
</tfoot>
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY