import { Component, OnInit, Inject } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; import { ConfirmDialogComponent } from 'app/commons/component/confirm-dialog/confirm-dialog.component'; @Component({ selector: 'of-probe-detail', templateUrl: './detail.component.html', styleUrls: ['./detail.component.scss'] }) export class DetailComponent implements OnInit { probeAlias = ''; probeId = undefined; isUpState = false; data = [ { key: 'key1', value: 'this is value' }, { key: 'key2', value: 'this is value' }, { key: 'key3', value: 'this is value' }, { key: 'key4', value: 'this is value' }, ]; constructor( private route: ActivatedRoute, private router: Router, public dialog: MatDialog, ) { } ngOnInit() { this.probeId = this.route.snapshot.paramMap.get('id'); this.probeAlias = 'Probe Alias 블라블라'; } handleStartStop() { this.isUpState = !this.isUpState; } handleRemove() { const dialogRef = this.dialog.open(ConfirmDialogComponent, { width: '250px', data: { title: 'Remove', message: 'Are you sure?' } }); // const dialogRef = this.dialog.open(RemoveWarningComponent, { // width: '250px', // data: { } // }); dialogRef.afterClosed().subscribe(confirmed => { if (confirmed) { console.log('confirmed'); } // 삭제 후 list로 back }); } }