Angular mat-select (selectionChange) event only fires once

Discussão em 'Angular' iniciado por Yogesh, Abril 9, 2025.

  1. Yogesh

    Yogesh Guest

    I am using angular mat-select for a multi-select dropdown and I am using the (selectionChange) to do something in my .ts file. All is working fine, expect that seems like (selectionChange) event is fired only when a different dropdown option is selected. If I select the same drop down option two times,the event is fired only the first time and it does not fire again. I guess this is as per the definition. Is there a way to have the event fired even if the same drop down element is selected. Here is a snippet of my code:

    <mat-select #someDropdown placeholder="My Account" disableOptionCentering panelClass="my-account-left-nav"
    (selectionChange)="onChangeSelected($event)" formControlName="select">
    <mat-optgroup *ngFor="let group of options" [label]="group.title">
    <ng-container *ngFor="let option of group.children">
    <mat-option [ngClass]="urlClasses(option) ? 'showitem' : 'hideitem'" [value]="option">
    {{option.title}}
    </mat-option>
    </ng-container>
    </mat-optgroup>

    Continue reading...

Compartilhe esta Página