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

169
Views
Angular Apertura de un cuadro de diálogo cuando se selecciona una opción

En mi aplicación, tengo un mat-form-field con una mat- mat- option. Quiero que se abra un cuadro de diálogo cuando selecciono un elemento de mat-option . Aquí está mi código. En este momento, cuando selecciono un elemento, no pasa nada. ¿Qué tengo que hacer?

HTML:

 <ng-container matColumnDef="Order"> <th mat-header-cell *matHeaderCellDef width="10%"> Sipariş No </th> <td mat-cell *matCellDef="let row; let i = index"> <span *ngIf="EditIndex != i">{{row.Order?.Subject}}</span> <mat-form-field floatLabel="never" *ngIf="EditIndex == i" class="w-100-p" style="min-width: 100px !important;"> <mat-select [(ngModel)]="row.Order" required name="Order" (selectionChange)="updateProducts($event.value)" style="min-width: 100px !important;"> <mat-select-trigger> {{row?.Order?.Reference}} </mat-select-trigger> <mat-option *ngFor="let order of originalSupplierOrders" [value]="order"> {{order.Reference + ' - ' + order.Subject}} </mat-option> </mat-select> </mat-form-field> </td> </ng-container>

TS:

 openSelectedOrderProductList(prm) { const dialogRef = this._dialog.open(SelectedOrderProductListDialogComponent, { width: "700px", data: prm, }); dialogRef.afterClosed().subscribe((result) => { //console.log(result); }); }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Debe activar la selección Cambiar para abrir el cuadro de diálogo. Agregue la "función openSelectedOrderProductList()" a (selectionChange).

HTML:

 <ng-container matColumnDef="Order"> <th mat-header-cell *matHeaderCellDef width="10%"> Sipariş No </th> <td mat-cell *matCellDef="let row; let i = index"> <span *ngIf="EditIndex != i">{{row.Order?.Subject}}</span> <mat-form-field floatLabel="never" *ngIf="EditIndex == i" class="w-100-p" style="min-width: 100px !important;"> <mat-select [(ngModel)]="row.Order" required name="Order" (selectionChange)="updateProducts($event.value);openSelectedOrderProductListfunction()" style="min-width: 100px !important;"> <mat-select-trigger> {{row?.Order?.Reference}} </mat-select-trigger> <mat-option *ngFor="let order of originalSupplierOrders" [value]="order"> {{order.Reference + ' - ' + order.Subject}} </mat-option> </mat-select> </mat-form-field> </td>
about 4 years ago · Juan Pablo Isaza Report

0

Si está utilizando formularios reactivos, le sugiero que use valueChanges , puede consultar esta respuesta .

De lo contrario, puede usar simplemente el evento selectionChange de <mat-select>

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!