Skip to content

Instantly share code, notes, and snippets.

@Ze1598
Created December 28, 2019 15:04
Show Gist options
  • Save Ze1598/227a0c32956cade2e65d2c91b6c1ca5d to your computer and use it in GitHub Desktop.
Save Ze1598/227a0c32956cade2e65d2c91b6c1ca5d to your computer and use it in GitHub Desktop.
Reusable modal component: modal.component.ts (first version)
import { Component, OnInit } from '@angular/core';
import { MatDialogRef } 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>
) { }
ngOnInit() { }
actionFunction() {
alert("I am a work in progress");
this.closeModal();
}
closeModal() {
this.dialogRef.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment