Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

80
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!