troubleshooting Question

Laravel Pagination + AngularJS

Avatar of eugene007
eugene007 asked on
LaravelBootstrapAngularMySQL ServerPHP
12 Comments3 Solutions899 ViewsLast Modified:

				<tr ng-repeat="person in employee | orderBy:orderByField:reverseSort">
						 <div class="btn-toolbar" role="toolbar">
							<button class="btn" ng-click="viewEmployee("><span class="glyphicon glyphicon-eye-open"></button> 
							<button class="btn" ng-click="editEmployee("><span class="glyphicon glyphicon-pencil"></button> 
							<button class="btn" ng-click="deleteEmployee("><span class="glyphicon glyphicon-trash"></button>
                    <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>  


	scope.maxSize = 5;
	scope.totalCount = 0;
	scope.pageIndex = 1;
	scope.pageSizeSelected = 5;

        scope.init = function(){
			method: 'GET',
			url: "/api/v1/employee/list?pageIndex=" + scope.pageIndex + "&pageSize=" + scope.pageSizeSelected
              }).then(function successCallback(response){
			scope.totalCount =; 
                        scope.numPages =  Math.ceil(scope.totalCount / scope.pageSizeSelected);			
		        scope.employee =;

       scope.pageChanged = function(){

How do I handle pageIndex in laravel? Apart from that I am receiving an error: [orderBy:notarray] when returning in the following manner:

  public function lsAll(){
        $employee = Employee::paginate(5);
	return $employee; 

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros