Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Laravel 5.x Cookbook

You're reading from  Laravel 5.x Cookbook

Product type Book
Published in Sep 2016
Publisher Packt
ISBN-13 9781786462084
Pages 402 pages
Edition 1st Edition
Languages
Authors (2):
Terry Matula Terry Matula
Profile icon Terry Matula
Alfred Nutile Alfred Nutile
Profile icon Alfred Nutile
View More author details

Table of Contents (17) Chapters

Laravel 5.x Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Setting Up and Installing Laravel 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

Adding Angular search to our search page


In this section, we are going to convert the search to be Angular-based. What this means is that when the users will type in a word to search, they will then press Search and instead of reloading the page, we will do a request using Ajax and take the response of this request. I am not doing it because they type, due to API limitations at Marvel, but you could do this.

I need to also consider pagination later on and other odds and ends later on to this API.

Getting ready

It would be good to setup Angular as I did in the preceding recipe so that you are ready to start updating the MainController and your custom js file.

How to do it…

  1. First, we set up MainController to look like this:

    I will create the searchFor method, and then define it in my vm area.

    Tip

    Placing bindable members at the top makes it easy to read and helps you to instantly identify which members of the controller can be bound and used in the View—John Papa Guide

    Then, I add disableSearch so...

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 €14.99/month. Cancel anytime}