projects/netgrif-components-core/src/lib/dialog/components/alert-dialog/alert-dialog.component.ts
Simple modal dialog with its own layout (which only shows information) based on a material design that injected data and inherits from an AbstractDialog.
selector | ncc-simple-dialog |
styleUrls | ./alert-dialog.component.scss |
templateUrl | ./alert-dialog.component.html |
Properties |
Methods |
constructor(dialogRef: MatDialogRef<AlertDialogComponent | DialogResult>, data: DialogData)
|
||||||||||||
Only injecting.
Parameters :
|
onClose |
onClose()
|
Inherited from
AbstractDialogComponent
|
Defined in
AbstractDialogComponent:27
|
Returns :
void
|
Public data |
Type : DialogData
|
Decorators :
@Inject(MAT_DIALOG_DATA)
|
Inherited from
AbstractDialogComponent
|
Defined in
AbstractDialogComponent:23
|
Injected data that was passed in to a dialog.
|
Public dialogRef |
Type : MatDialogRef<AlertDialogComponent | DialogResult>
|
Inherited from
AbstractDialogComponent
|
Defined in
AbstractDialogComponent:22
|
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