1

My routerlink is working but after trying to convert it to a function it just does nothing. I have tried many things already: '/description' 'description' '/description/'.

before:

  <a [routerLink]="['description', course.id]">Go to description</a>

After (.html):

  <a (click)="goToDescription(course.id)">Go to description</a>

After (.ts):

  goToDescription(id) {
    this.router.navigate([`description`, id]);
  }

Route Description:

  {
    path: 'description/:course-id', component: CourseDescriptionComponent,
  },

Any help would be appreciated. Thanks!

Mike Smith
  • 527
  • 2
  • 6
  • 20
user3140824
  • 338
  • 5
  • 25

1 Answers1

2

I put the absolute url and it worked thanks to @Kamil Augustyniak who sent a link that helped me

  this.router.navigateByUrl(`/courses/description/${id}`);
user3140824
  • 338
  • 5
  • 25