# All files / src/lib/components/material dialog.component.ts

66.66% Statements 12/18
45.45% Branches 10/22
25% Functions 1/4
66.66% Lines 8/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    291x
    1x
    1x
    1x
    1x

    1x

    1x

    1x

     import { Component, Inject } from '@angular/core';
    import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
    I
    export interface DialogData {
    	title: string;
    	description: string;
    	showActionButtons: boolean;
    }

    @Component({
    	selector: 'ov-dialog-template',
    	template: `
    		<h1 mat-dialog-title>{{data.title}}</h1>
    		<div mat-dialog-content>{{data.description}}</div>
    		<div mat-dialog-actions *ngIf="data.showActionButtons">
    			<button mat-button (click)="close()">Close</button>
    		</div>
    	`
    })
    export class DialogTemplateComponent {
    	constructor(public dialogRef: MatDialogRef<DialogTemplateComponent>, @Inject(MAT_DIALOG_DATA) public data: DialogData) {
    		console.log(data)
    	}

    	close() {
    		this.dialogRef.close();
    	}
    }