empty path redirection on home page in angular routing
/* Redirection of empty path on home page path in angular */
Now that we have added routing to the home and about components, let's see how to redirect users to the /home path when they first visit our app from the empty path.
We simply need to add a new route that matches the empty path and redirect it to the /home path as follows:
const routes: Routes = [
{ path: '', pathMatch: ‘full’, redirectTo: 'home' },
{ path: 'home', component: HomeComponent },
{ path: 'about', component: AboutComponent }
];
Internally, the router uses a function called 'applyRedirects' to process redirects.
/*
I hope it will help you.
Namaste
Stay Home Stay Safe
*/
Also in JavaScript:
- nexe Error: vcbuild.bat nosign release x64 exited with code: 1
- how to disable time option in select jquery
- angularjs find and update object in array
- generate express app
- update node.js dependencies
- dynamic loaded content can't find library jqury
- get last element in array javascript
- how to make a translator in python
- js unspecified parameters
- ejs partial pass value
- codepen
- check if a variable is undefined jquery
- javascript onclick to another page div
- javascript foreach break
- jquery array compare values
- get the last element of array javascript
- arduino vscode hex
- creating a web server in js
- how to print elements in an array in javascript
- js string to object
- javascript infinite loop
- moment get month day
- how to send mail node.js
- array sorting javascript mergesort