Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

82
Vistas
Refreshing page always redirects to base URL

I have angular app with routes to components

Here is routes file

  const routes: Routes = [
  { path: '', component: HomeComponent },
  {
    path: 'main',
    children: [
      { path: 'faq', component: FaqComponent },
      { path: 'faq-mobile', component: FaqMobileComponent },
      { path: 'neighborhoods', component: NeighborhoodsComponent },
      { path: 'sales', component: SalesComponent },
      { path: 'commercials', component: CommercialsComponent },
      { path: 'rentals', component: RentalsComponent },
      { path: 'contact-us', component: ContactUsComponent },
      { path: 'list-with-us', component: ListWithUsComponent },
      { path: 'no-mobile', component: NoMobileComponent },
      { path: 'about-us', component: AboutUsComponent },
      { path: 'jobs', component: JobsComponent },
      { path: 'rooms', component: RoomsComponent },
      { path: 'join-the-hunt', component: JoinTheHuntComponent },
      { path: 'apply', component: ApplyMainComponent },
      { path: 'apply/:id', component: ApplyDetailsComponent },
      { path: 'home-mobile', component: HomeMobileComponent },
      { path: 'getting-approved', component: GettingApprovedComponent },
    ],
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule {}

When for example I use link http://localhost:4200/main/apply and just refresh link it returns me to http://localhost:4200

How I can make it to stay at http://localhost:4200/main/apply?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

In my angular-project I have it like this:

{
    path: '', 
    redirectTo: 'dashboard',
    pathMatch: 'full'
}

--> so adding pathMatch: 'full' might do the trick here.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Use { path: '', component: HomeComponent, pathMatch: 'full' } for your first route. When you refresh you get redirected to HomeComponent because it is the first route that matches your path.

Have a look at: In Angular, What is 'pathmatch: full' and what effect does it have?

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda