Vidsify
Vidsify

Reputation: 57

How to remove a redirect of a URL from Angular Routing

When visiting mywebsite.com I don't want it to redirect to mywebsite.com/home I would like it to stay at /

How do I do that as I am using Angular Routing?

I have looked at the Angular Docs and Googled it but couldn't seem to find the answer

Upvotes: 0

Views: 1705

Answers (2)

ilyas shabi
ilyas shabi

Reputation: 194

Go to your app-routing.module.ts file and in the bottom of the file edit this snippet to:

{
 path: '',
 redirectTo: 'home',
 pathMatch: 'full'
},
{
 path: 'home',
 component: HomeComponent
}

Upvotes: 0

Chunbin Li
Chunbin Li

Reputation: 2244

You can add HomeCompeont to your root path in the route config

[{
  {
    path: '',
    component: HomeComponent,
    pathMatch: 'full'
  },
  {
    path: 'home',
    component: HomeComponent
  }
  .........
}]

Upvotes: 1

Related Questions