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

364
Views
How to know if angular router has registered route

I'm migrating a set of Anguar microsites info module federation based MFE architecture.

Not all apps will be migrated at once, so I have this issue to solve:

So far, all cross-microsite links were just regular a tags with href and full page reload was done.

Now, as MFEs are being loaded into the shell one by one, sometimes links will point to valid angular route (if MFE was lazy loaded using module federation), but sometimes not.

So, sometimes link would need to be rendered using routerLink directive and sometimes using href.

Is there a way to tell if a route e.g. apps/admin is valid Angular route at runtime in order to decide whether to use routerLink or href?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I'm not sure what you really want, but you can use router.config and loop over it to check if certain path exists or not

  constructor(private router: Router) {
    console.log(this.router.config);
  }


  routeExists(path: string): boolean {
    return this.router.config.some((route) => route.path === path)
  }
over 4 years ago · Santiago Trujillo 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!