Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
How to change primeng dropdown value/option if url changes

I am very new to Primeng and Angular, Can you help me with this please:

How to change my param in URL using Primeng drop-down in Angular: (ex. shop1 in URL to shop2) http://localhost:4200/#/shops/shop1/dashboard and vice versa if I change URL so it must change the value of drop-down as well.

 <p-dropdown [options]="clientShops" [(ngModel)]="selectedShop" optionLabel="name" (onChange)="onChange($event)"></p-dropdown>

My OnChange($event) function returns {shopId: 'shop2', name: 'Shop 2'} in component How to get shopId from event?:

   onChange(event: any) {    
// How to get shopId from event?
            let shopId = ""; 
           this.router.navigate([`/shops/${shopId}/dashboard`]);
            console.log('event :' + event);
            console.log(event.value);
        }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

        // import 
        import { ActivatedRoute, Router } from "@angular/router";

        // in your constructor
        constructor(private route: ActivatedRoute,private router: Router) {}

        // on changing the dropdown value
        onDropdownChange(event: any) {
        this.router.navigate(['../../', + event.shopId + '/dashboard'],{relativeTo: this.route});
        }

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!