Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Laravel 5.x Cookbook

You're reading from   Laravel 5.x Cookbook A recipe-based book to help you efficiently create amazing PHP-based applications with Laravel 5.x

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781786462084
Length 402 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Terry Matula Terry Matula
Author Profile Icon Terry Matula
Terry Matula
Alfred Nutile Alfred Nutile
Author Profile Icon Alfred Nutile
Alfred Nutile
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Setting Up and Installing Laravel FREE CHAPTER 2. Using Composer Packages 3. Routing 4. Building Views and Adding Style 5. Working with Data 6. Adding Angular to Your App 7. Authentication, Security, and Subscriptions 8. Testing and Debugging Your Application 9. Adding Advanced Features to Your App 10. Deploying Your App Index

Paginating our Angular results


Now we have a ton of results, 730, as seen in this request:

Since we cannot show all 730 at once, and since the API gives us 20 at a time, let's paginate through their APIs.

Getting ready

Use a fresh Laravel installation and follow these steps.

How to do it…

  1. Install a library that helps with pagination and tons of other things:

    >npm install angular-ui-bootstrap --save
    
  2. Then, load the library into our public folder by copying it over to public/js and public/css. Later, we will optimize this part of the workflow:

  3. You will find all of these here:

  4. Then into the top of resources/views/layout.blade.php:

  5. And at the bottom of the same file:

  6. Now, in our public/js/app.js, we load the library:

  7. Now that we have loaded the libraries, let's use the Pagination buttons at the top and bottom of resources/views/home/_angular_search_results.blade.php:

  8. Let's take a closer look:

  9. The Angular Controller now needs to consider this new API query string and data points:

    I will go into the details...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image