I am facing an issue with my Material Dialog not working properly. Can anyone point out what I might be missing?
product-thumbnail.ts I will use this to trigger the dialog
export class ProductThumbnailComponent implements OnInit {
@Input() product: Product;
constructor(public dialog: MatDialog) { }
ngOnInit() {
}
openPopup(prod) {
this.dialog.open(ProductPageComponent, {
autoFocus: true,
width: '400px',
data: {product: prod}
});
}
}
product-page.ts This is the component for the dialog box
export class ProductPageComponent implements OnInit {
@Input() product: Product;
constructor(
private cartService: CartService,
public dialogRef: MatDialogRef<ProductPageComponent>,
@Inject(MAT_DIALOG_DATA) private data
) { }
ngOnInit() {
}
onAddToCart() {
this.cartService.addToCart(this.product);
}
}