Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

224
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda