1

I'm trying to navigate to a new tab on a click event, and I need to pass query param

<div  (click)="viewDetails()">view<div>

function

import { NavigationExtras, Router } from '@angular/router';

viewDetails(){
    let navigationExtras: NavigationExtras = {
    queryParams: {
       "selectedAssessmentId": 10
    }
  };
 this.router.navigate(['./view'], navigationExtras)
}

Currently, am able to open in current tab. but, I need it to be open in new tab with query params. I tried with [RouterLink] also but faced the same issue.

arun kumar
  • 1,151
  • 1
  • 11
  • 25

1 Answers1

2

you can use routerLink in your template

<a [routerLink]="['/view']" [queryParams]="{id: 10}" target="_blank">view</a>
arun kumar
  • 1,151
  • 1
  • 11
  • 25
chestas
  • 124
  • 1
  • 6