0

I'm having problems developing a route as default... if you put sitename.com ... it assumes the default Login route, getting sitename.com/login, so far so good....

My problem is that if I go to the page through a sitename.com/home shortcut... I don't see any page, as if I couldn't find the path... I wanted to put this shortcut on the default page. .. Login.

To do this do I have to configure the routes or do I have to do something else?

Can anyone help me?

app.module.ts

import { RouterModule, Routes } from '@angular/router';

 imports: [
    RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' }),
 ],

const routes: Routes = [
  { path: '', redirectTo: 'login', pathMatch: 'full' },
 { path: 'home', component: HomeComponent },

];
isherwood
  • 58,414
  • 16
  • 114
  • 157
Harry
  • 621
  • 3
  • 9
  • 21
  • 3
    Does this answer your question? [Angular2 router (@angular/router), how to set default route?](https://stackoverflow.com/questions/37605119/angular2-router-angular-router-how-to-set-default-route) – Reece Sep 29 '21 at 13:23

1 Answers1

0

You can try

RouterModule.forRoot(routes, {useHash: true})

and Login page will be accessed by direct URL as sitename.com/#/login

plotnik
  • 372
  • 2
  • 5