Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
40
rated 0 times [  46] [ 6]  / answers: 1 / hits: 23463  / 5 Years ago, wed, august 28, 2019, 12:00:00

I am trying to Navigate to a new page on click of an icon and below is the code



  this.prj = e.data.project_number;
this.router.navigateByUrl('/dashboard/ProjectShipment/634');


Instead of this hardcoded query parameter 000634 I have to pass a this.prj in to it. My path is like below



const appRoutes: Routes = [
{
path: 'dB',
data: { title: 'Dashboard' },
children: [
{
path: 'ProjectShipment/:reportProject',
component: ProjectShipmentComponent,
data: { title: 'Project Shipment' },
}

More From » angular

 Answers
39

Simply use string interpolation



this.router.navigateByUrl(`/dashboard/ProjectShipment/${this.prj}`);

[#51723] Tuesday, August 20, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ryanulyssesb

Total Points: 91
Total Questions: 105
Total Answers: 102

Location: England
Member since Tue, Sep 8, 2020
4 Years ago
ryanulyssesb questions
Sat, Mar 20, 21, 00:00, 3 Years ago
Mon, Sep 14, 20, 00:00, 4 Years ago
Mon, Mar 9, 20, 00:00, 4 Years ago
Sun, Jul 7, 19, 00:00, 5 Years ago
;