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

138
Views
routerLink does not generate the link correctly

This html button with routerLink attribute:

<button [routerLink]="['/projects', 'edit', project?.id]">E`enter code here`dit</button>

result in this link:

  router-link="/projects,edit,1011"

I can not see from the documentation: https://angular.io/docs/ts/latest/api/router/index/RouterLink-directive.html

that I do something wrong.

This sample looks nearly like mine:

['/team', teamId, 'user', userName, {details: true}]

what do I wrong?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You can associated code with a button click and then route with a method such as this:

onSaveComplete(message?: string): void {
    if (message) {
        this.messageService.addMessage(message);
    }
    this.reset();
    // Navigate back to the product list
    this.router.navigate(['/products']);
}
over 4 years ago · Santiago Trujillo Report

0

As far as I know, the routerLink needs to be on a link element. Such as this:

<a class="btn btn-primary" 
  [routerLink]="['/productEdit', product.id]">
  Edit
</a>
over 4 years ago · Santiago Trujillo Report

0

RouterLink' input is an array of strings, so in html:

<button [routerLink]="routerLink">My button</button>

TS:

routerLink = project.id ? ['/projects', 'edit', project.id] : ['/projects', 'edit']
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!