DEV Community

Cover image for How to use routerLink in Angular to specify value of parameter in url
Adrian Matei for Codever

Posted on • Edited on • Originally published at codever.dev

3 2

How to use routerLink in Angular to specify value of parameter in url

Project: codever - File: bookmark-list-element.component.html

Use a two-element array when specifying a route parameter:

<div *ngFor="let tag of bookmark.tags" class="btn-group tag-list  mr-2 mt-1"> 
  <a class="dropdown-item"
     [routerLink]="['/tagged', tag]"
     title='Public bookmarks tagged "{{tag}}"'>
    <i class="fas fa-tag"></i> Public
  </a>
</div>
Enter fullscreen mode Exit fullscreen mode

This will generate a link similar to the following https://www.codever.dev/tagged/angular, where the value of the tag parameter in routerLink is the string angular


Reference -

https://angular.io/guide/router


Shared with ❤️ from Codever. 👉 use the copy to mine functionality to add it to your personal snippets collection.

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post →

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series