File

projects/netgrif-components-core/src/lib/dialog/components/alert-dialog/alert-dialog.component.ts

Description

Simple modal dialog with its own layout (which only shows information) based on a material design that injected data and inherits from an AbstractDialog.

Extends

AbstractDialogComponent

Metadata

selector ncc-simple-dialog
styleUrls ./alert-dialog.component.scss
templateUrl ./alert-dialog.component.html

Index

Properties
Methods

Constructor

constructor(dialogRef: MatDialogRef<AlertDialogComponent | DialogResult>, data: DialogData)

Only injecting.

Parameters :
Name Type Optional Description
dialogRef MatDialogRef<AlertDialogComponent | DialogResult> No

Reference to a dialog opened via the MatDialog service.

data DialogData No

Injected data that was passed in to a dialog.

Methods

onClose
onClose()
Inherited from AbstractDialogComponent
Returns : void

Properties

Public data
Type : DialogData
Decorators :
@Inject(MAT_DIALOG_DATA)
Inherited from AbstractDialogComponent
Injected data that was passed in to a dialog.
Public dialogRef
Type : MatDialogRef<AlertDialogComponent | DialogResult>
Inherited from AbstractDialogComponent
Reference to a dialog opened via the MatDialog service.
import {Component, Inject} from '@angular/core';
import {AbstractDialogComponent} from '../../models/abstract-dialog.component';
import {DialogData} from '../../models/DialogData';
import {DialogResult} from '../../models/DialogResult';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';

/**
 * Simple modal dialog with its own layout (which only shows information) based on a material design
 * that injected data and inherits from an [AbstractDialog]{@link AbstractDialogComponent}.
 */
@Component({
    selector: 'ncc-simple-dialog',
    templateUrl: './alert-dialog.component.html',
    styleUrls: ['./alert-dialog.component.scss']
})
export class AlertDialogComponent extends AbstractDialogComponent<AlertDialogComponent> {
    /**
     * Only injecting.
     * @param dialogRef Reference to a dialog opened via the MatDialog service.
     * @param data Injected data that was passed in to a dialog.
     */
    constructor(public dialogRef: MatDialogRef<AlertDialogComponent, DialogResult>,
                @Inject(MAT_DIALOG_DATA) public data: DialogData) {
        super(dialogRef, data);
    }

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

}
<h1 mat-dialog-title>{{data.title}}</h1>

<div mat-dialog-content class="dialog-container dialog-content-margin">{{data.content}}</div>

<mat-dialog-actions fxLayoutAlign="end">
    <button mat-button color="primary" (click)="onClose()">OK</button>
</mat-dialog-actions>

./alert-dialog.component.scss

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""