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

110
Views
Angular Routing not working with different components

I have two components. Component A and Component B. I want to create a navigation system in component A that on click will load the appropriate element in component B. I know within the same component we can use routerLink and router-outlet. But how can i achieve the same in my case ??

for example:

Component A

<a routerLink="/userHome"></a>

Component B

<router-outlet></router-outlet>

And my routing module is :

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {RouterModule, Routes} from '@angular/router';
import {UserHomeMainBodyComponent} from './components/user-home-                
main-body/user-home-main-body.component';
import {UserNotificationsBodyComponent} from './components/user-    
notifications-body/user-notifications-body.component';

const routes: Routes = [
  { path: 'userHome', component: UserHomeMainBodyComponent},
  {path: 'userNotifications', component:UserNotificationsBodyComponent}
];

@NgModule({
  declarations: [],
  imports: [
    CommonModule,
    RouterModule.forRoot(routes)
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }
about 4 years ago · Juan Pablo Isaza
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!