Angular Material <mat-select> trigger function on select in <mat-form-field>

400 Views Asked by At

I use Angulars Material library in a WebApp and have the following code snippet of a form-field, that triggers the function `selectionEntered()' implemented in my components .ts code.

    <mat-form-field style="margin-right:2em;margin-bottom:2em;" >
        <mat-label>Selection Label</mat-label>
        <mat-select [(ngModel)] = "selectionEntered" (selectionChange)="selectProductionCharge(selectionEntered)">
            <mat-option *ngFor="let selectionElement of componentsService.selectionOptions" [value]="selectionElement">{{selectionElement}}</mat-option>
        </mat-select>
    </mat-form-field>

Okay that works fine when selected once or a selectionChange happens. BUT how do I trigger the `selectionEntered()' function not just on a change but every time a field is selected and not just the value changed? Thanks in advance.

I already tried to change the "selectionChange" to selected but had no success in doing so. I expect the selectionChange function to be called every time I select a field.

0

There are 0 best solutions below