How to set default route in Angular 13| Full Match| Wild Card Route | Routing Angular |Part 14

preview_player
Показать описание
When the application start, it navigates to the empty route by default. We can configure the router to redirect to a named route by default. So, a redirect route translates the initial relative URL (”) to the desired default path. For example, if may want to redirect to Login page or registration page by default when the application start.
This route redirects a URL that fully matches the empty path to the route whose path is ‘/Login’. The empty path in the first route represents the default path for the application. This default route redirects to the route for the /Login URL and therefore will display the Login Component.

A redirect route requires a pathMatch property to tell the router how to match a URL to the path of a route. The router throws an error if you don’t. For the special case of an empty URL we also need to add the pathMatch: ‘full’ property so angular knows it should be matching exactly the empty string and not partially the empty string.
Рекомендации по теме
Комментарии
Автор

thank you so much, i love u salman <3

fabiibruh
Автор

dude thank you so much u really helped me

russianteemo