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

298
Views
¿Cómo verificar los cambios en el menú de selección en Angular?

¿Cómo saber usando OpenChange que cuando cierra o abre el panel de selección del tapete, se mostrará si hay un elemento en el cuadro de selección que estaba marcado o desmarcado?

En este momento solo puedo detectar si está abierto o cerrado, quiero detectarlo cuando lo cierre si hay alguna actividad o seleccione elementos en el menú de selección. Gracias.

Quiero comprobar si hay algún cambio.

#código HTML

 <mat-form-field class="job-filter" appearance="fill"> <mat-select #select [formControl]="marketDropdownMultiCtrl" placeholder="Market" [multiple]="true" #marketDropdownMultiSelect (openedChange)="changeFilterEvent($event,select)"> <mat-option> <ngx-mat-select-search [showToggleAllCheckbox]="true" accesskey="" placeholderLabel="Search Market filter" noEntriesFoundLabel="'No results found'" (toggleAll)="toggleSelectAllMarket($event)" [toogleAllCheckboxTooltipPosition]="'above'" [toggleAllCheckboxChecked]="marketDropdownMultiCtrl?.value?.length === marketDropdownSize" [toggleAllCheckboxIndeterminate]="marketDropdownMultiCtrl?.value?.length > 0 && marketDropdownMultiCtrl?.value?.length < marketDropdownSize" [toggleAllCheckboxTooltipMessage]="'Select / Deselect all Market filters'" [formControl]="marketDropdownMultiFilterCtrl"> </ngx-mat-select-search> </mat-option> <mat-option *ngFor="let market of filteredMarketListMulti | async" [value]="market"> {{market.description}} </mat-option> </mat-select> </mat-form-field>

ingrese la descripción de la imagen aquí

#tscode

 changeFilterEvent(opened:boolean,element:any){ }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Antes de abrir, haga una copia de marketDropdownMultiCtrl.value -

 this.oldValue=marketDropdownMultiCtrl.value

Después de cerrar los valores de comparación

 if (marketDropdownMultiCtrl.value!=this.oldValues) ...do something.. })

si desea verificar cualquier cambio al mismo tiempo que marca/desmarca cualquier valor, también puede suscribirse a this.marketDropdownMultiCtrl.valueChanges usando pipe pairwise

 ngOnInit() { this.marketDropdownMultiCtrl=new FormControl(null); this.marketDropdownMultiCtrl.valueChanges.pipe( //it's necesary send a first value startWith(this.marketDropdownMultiCtrl.value), pairwise()) //the pairwise make the "magic" .subscribe(([old,value])=>{ if (old!=value) { console.log("I change from "+old+" to "+value) } })
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!