DEV Community

Akhil Ashok
Akhil Ashok

Posted on

Angular 8

hi, any one knows how to pass multiple data to dialoge box?

angular8 #java #springboot

Top comments (4)

Collapse
 
leobm profile image
Felix Wittmann • Edited

What type of dialog boxes ?

Or is your question how to pass multiple properties to a component ?

Or do you open a javascript dialog with window.open ?

Collapse
 
dreamcatcher8055 profile image
Akhil Ashok • Edited

Matdialoge box

Collapse
 
leobm profile image
Felix Wittmann • Edited

MatDialogConfig has a 'data' property.
Maybe this is the place for own properties ?

MatDialogConfig is the second parameter of the open method.

Edit:
When I understand it correctly.
In your own dialog component you can than later access the MatDialogRef in your constructor.

Edit:

This looks better:

you can inject the data.


import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
....

export class YourDialogComponent {
  constructor(
    @Inject(MAT_DIALOG_DATA) public data: any,
    public dialogRef: MatDialogRef<YourDialogComponent >
  ) {....}

Thread Thread
 
dreamcatcher8055 profile image
Akhil Ashok

Ok