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

342
Views
El cuadro de diálogo aparece en la parte inferior de la página en angular

Quiero mostrar un cuadro de diálogo en angular para confirmar una acción de eliminación, pero el cuadro no aparece y se agrega al final de la página. Aquí está el archivo ts de mi componente de diálogo:

 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; export class DeleteBoxComponent implements OnInit { constructor(private dialogRef: MatDialogRef<DeleteBoxComponent>, @Inject(MAT_DIALOG_DATA) public data: CBookModel, private service: BookService) { } onNoClick(){ this.dialogRef.close(); } onYesClick(){ this.service.delete(this.data.id).subscribe(response => { this.dialogRef.close(); }) } }

Aquí está el archivo html del componente de diálogo:

 <div class="mat-container position-relative"> <h1 mat-dialog-title>DELETE</h1> <mat-dialog-content class="mat-typography"> <p>Are you Sure you want to delete "{{data.title}}"</p> </mat-dialog-content> <mat-dialog-actions> <button mat-button (click)="onNoClick()">No</button> <button mat-button (click)="onYesClick()">Yes</button> </mat-dialog-actions> </div>

Y aquí hay otro componente que llama al componente de diálogo:

 import { DeleteBoxComponent } from './../delete-box/delete-box.component'; import { MatDialog } from '@angular/material/dialog'; export class BooksComponent implements OnInit { constructor(private service: BookService,public router:Router, public dialog: MatDialog) { } onClickDelete(book: CBookModel) { const dialogRef = this.dialog.open(DeleteBoxComponent, {width: '250px',backdropClass: 'backdropBackground', data: book}); dialogRef.afterClosed().subscribe( Response =>{ this.service.getAll() .subscribe(data => this.books = data); }) } }

imagen

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Según su captura de pantalla, creo que no ha configurado los estilos de Material.
Siga Primeros pasos y se configurará.

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!