DEV Community

Andrei Gatej
Andrei Gatej

Posted on

2

Angular: Why RouterLink adds the input to the end of current URL in bracket

Lets say my url is: http://localhost:4200/user_id/home. Here is my button code:

  <ion-button [routerLink]="['some_user_id', 'payments']" routerLinkActive="selected"&gt
    <ion-label class="label">Payments</ion-label>
  </ion-button>

Because I was getting Error: Cannot match any routes. I started to investigate the problem and I come to, that routerLink is generating such DOM element:

<a href="user_id/home/(some_user_id/payments)" class="button-native" part="native">

When (in…

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay