I have a problem I need to pass an object to a mat-dialog. When I consult the value of the object, it is shown with all its properties, the problem occurs when I need to access the properties, they are shown as undefined.
Main Component:
EditDialog(nameInput: String, emailInput: String) {
const dialogInstance = this.dialog.open(EditDialogComponent,
{
width: "40%",
disableClose: true,
data: { person: {name: nameInput, email: emailInput } }
}
);
}
Dialog Component:
constructor(private _formBuilder: FormBuilder,
@Inject(MAT_DIALOG_DATA) private person: any
) {
console.log(this.person); <-- show object data
console.log(this.person.name); <-- show undefined
}
Thanks any help