routerLink with query params in Angular html template
Use routerLink
and queryParams
as inputs to the link as in the following example:
<a class="dropdown-item" [routerLink]="['/my-bookmarks/new']" [queryParams]="{initiator: 'browser'}">
<i class="fa fa-bookmark"></i>
Bookmark
</a>
This will generate an url like the following https://www.codever.dev/my-bookmarks/new?initiator=browser
Project: codever
- File: navigation.component.html
Shared with from Codever.
👉 Use the Copy to mine
functionality to copy this snippet to your own personal collection and easy manage
your code snippets.
Codever is open source on Github ⭐🙏