Solución:
Puedes usarlo como:
<mat-autocomplete #auto="matAutocomplete" (optionSelected)='getPosts($event.option.value)'>
DEMO DE TRABAJO
Se puede hacer de dos formas.
- Utilizando
onSelectionChange
que emiteMatOptionSelectionChange
demat-option
<mat-autocomplete #auto="matAutocomplete">
<mat-option
*ngFor="let option of options"
[value]="option"
(onSelectionChange)="updateMySelection($event)"
>
{{ option }}
</mat-option>
</mat-autocomplete>
- Utilizando
optionSelected
que emiteMatAutocompleteSelectedEvent
demat-autocomplete
<mat-autocomplete
#auto="matAutocomplete"
(optionSelected)="updateMySelection($event)">
<mat-option
*ngFor="let option of options"
[value]="option"
>
{{ option }}
</mat-option>
</mat-autocomplete>
<mat-form-field floatLabel="always">
<mat-label>UTBMS Activity Codes</mat-label>
<input type="text" placeholder="Activity Codes" [(ngModel)]="activityCode" aria-label="Number" matInput [formControl]="utbmsActivityCodesControl"
[matAutocomplete]="autoActivityCodes">
<mat-autocomplete autoActiveFirstOption #autoActivityCodes="matAutocomplete">
<mat-option *ngFor="let option of utbmsActivityCodes | async" (onSelectionChange)="setBillingActivity(option)" [value]="option.code">
{{option.name}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
setBillingActivity(object){
this.actionData.libraryContent.billingActivityId=object.activityId;
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)