Search icon CANCEL
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
Angular Router

You're reading from   Angular Router From Angular core team member and creator of the router

Arrow left icon
Product type Paperback
Published in Mar 2017
Publisher Packt
ISBN-13 9781787288904
Length 118 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Victor Savkin Victor Savkin
Author Profile Icon Victor Savkin
Victor Savkin
Arrow right icon
View More author details
Toc

Applying redirects


The router gets a URL from the user, either when she clicks on a link or updates the location bar directly. The first thing that router does with this URL is it will apply any redirects.

What is a redirect?

Note

A redirect is a substitution of a URL segment. Redirects can either be local or absolute. Local redirects replace a single segment with a different one. Absolute redirects replace the whole URL. Redirects are local unless you prefix the url with a slash.

The provided configuration has only one redirect rule: { path: '', pathMatch: 'full', redirectTo: '/inbox' }, i.e., replace / with /inbox. This redirect is absolute because the redirectTo value starts with a slash.

Since we are navigating to /inbox/33/messages/44 and not /, the router will not apply any redirects, and the URL will stay as is.

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