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

917
Views
Mat-autocompletar - ¿Cómo acceder a la opción seleccionada?

Sé que [value] almacena el Objeto seleccionado (Oferta en mi caso). Según la documentación de materiales, optionSelected emite un evento. [optionSelected] = "fooFn" pero no existe. Solo quiero acceder al objeto Oferta. ¡Gracias!

oferta-búsqueda.componente.html:

 <h5 #offerP>option - autoComplete</h5> <mat-form-field id="form-field"> <input type="text" matInput [formControl]="myControl" [matAutocomplete]="auto"> <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn"> <mat-option *ngFor="let option of filteredOptions$ | async" [value]="option"> {{ option.foodItem.name }} </mat-option> </mat-autocomplete> </mat-form-field>
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Puedes usarlo como:

 <mat-autocomplete #auto="matAutocomplete" (optionSelected)='getPosts($event.option.value)'>

DEMO DE TRABAJO

over 4 years ago · Santiago Trujillo Report

0

Se puede hacer de dos formas

  1. Usando onSelectionChange que emite MatOptionSelectionChange desde mat-option
 <mat-autocomplete #auto="matAutocomplete"> <mat-option *ngFor="let option of options" [value]="option" (onSelectionChange)="updateMySelection($event)" > {{ option }} </mat-option> </mat-autocomplete>
  1. Usando optionSelected que emite MatAutocompleteSelectedEvent desde mat-autocomplete
 <mat-autocomplete #auto="matAutocomplete" (optionSelected)="updateMySelection($event)"> <mat-option *ngFor="let option of options" [value]="option" > {{ option }} </mat-option> </mat-autocomplete>
over 4 years ago · Santiago Trujillo Report

0

 <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; }
over 4 years ago · Santiago Trujillo 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!