Created
December 28, 2019 18:09
-
-
Save Ze1598/9d0b9c733857661b0e9506aadd5b5535 to your computer and use it in GitHub Desktop.
Reusable modal component: modal.component.ts (second version)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, Inject } from '@angular/core'; | |
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; | |
@Component({ | |
selector: 'app-modal', | |
templateUrl: './modal.component.html', | |
styleUrls: ['./modal.component.css'] | |
}) | |
export class ModalComponent implements OnInit { | |
constructor( | |
public dialogRef: MatDialogRef<ModalComponent>, | |
@Inject(MAT_DIALOG_DATA) private modalData: any, | |
) { | |
console.log(this.modalData); | |
} | |
ngOnInit() {} | |
actionFunction() { | |
this.closeModal(); | |
} | |
closeModal() { | |
this.dialogRef.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment