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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Full-Stack Web Development with ASP.NET Core

You're reading from   Hands-On Full-Stack Web Development with ASP.NET Core Learn end-to-end web development with leading frontend frameworks, such as Angular, React, and Vue

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781788622882
Length 478 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Amir Zuker Amir Zuker
Author Profile Icon Amir Zuker
Amir Zuker
Tamir Dresher Tamir Dresher
Author Profile Icon Tamir Dresher
Tamir Dresher
Shay Friedman Shay Friedman
Author Profile Icon Shay Friedman
Shay Friedman
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Becoming a Full-Stack .NET Developer 2. Setting Up Your Development Environment FREE CHAPTER 3. Creating a Web Application with ASP.NET Core 4. Building REST APIs with ASP.NET Core Web API 5. Persisting Data with Entity Framework 6. Securing the Backend Server 7. Troubleshooting and Debugging 8. Getting Started with Frontend Web Development 9. Getting Started with TypeScript 10. App Development with Angular 11. Implementing Routing and Forms 12. App Development with React 13. App Development with Vue 14. Moving Your Solution to the Cloud 15. Deploying to Microsoft Azure 16. Taking Advantage of Cloud Services 17. Other Books You May Enjoy

Using Angular Router


In Everyday Market, let's implement the following routes:

  • /products: This is the default route that displays the product's listing homepage.
  • /products/new : This displays the form to create a new product.
  • /products/:id : This displays product details for the specified product id. The fact that the id is prefixed with a colon instructs Angular Router to treat it as a parameter and match it with the URL.

These routes are illustrated in the following diagram:

 

Using Angular Router, let's implement client-side routing with the following steps:

  1. Create the components to be used in the new routes with the following command:
 ng generate component modules/market/product-view-page

 ng generate component modules/market/product-edit-page
  1. Define the market routes configuration in market.module.ts as follows:
    1. Import RouterModule and Routes from the @angular/router package.
    2. Create a routes configuration object.
    3. Import RouterModule as part of MarketModule.
    4. You can remove the exported ProductsPageComponent...
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