File

src/module/components/dialogs/mat-async-dialog/mat-async-dialog.component.ts

Implements

OnInit

Metadata

selector mat-async-dialog
styleUrls ./mat-async-dialog.component.scss
templateUrl ./mat-async-dialog.component.html

Index

Properties
Methods

Constructor

constructor(dialogRef: MatDialogRef, data: MatAsyncDialogData)
Parameters :
Name Type Optional
dialogRef MatDialogRef<MatAsyncDialog> No
data MatAsyncDialogData No

Methods

ngOnInit
ngOnInit()
Returns : void

Properties

color
Type : ThemePalette
Public data
Type : MatAsyncDialogData
Decorators :
@Optional()
@Inject(MAT_DIALOG_DATA)
Public dialogRef
Type : MatDialogRef<MatAsyncDialog>
icon
Type : string
title
Type : string
import {Component, Inject, OnInit, Optional} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef, ThemePalette} from '@angular/material';

export interface MatAsyncDialogData {
  title?: string;
  icon?: string;
  color?: ThemePalette;
}

@Component({
  selector: 'mat-async-dialog',
  templateUrl: './mat-async-dialog.component.html',
  styleUrls: ['./mat-async-dialog.component.scss']
})
export class MatAsyncDialog implements OnInit {

  title: string;
  icon: string;
  color: ThemePalette;

  constructor(public dialogRef: MatDialogRef<MatAsyncDialog>,
              @Optional() @Inject(MAT_DIALOG_DATA) public data: MatAsyncDialogData) {
  }

  ngOnInit() {
    if (this.data) {
      this.title = this.data.title ? this.data.title : 'Loading...';
      this.icon = this.data.icon ? this.data.icon : '';
      this.color = this.data.color ? this.data.color : 'primary';
    }
  }

}
<mat-dialog-content fxLayout="column">
  <div class="title">
    {{title}}
  </div>
  <div fxFlex fxLayout="row" fxLayoutAlign="center center">
    <mat-spinner [color]="color"></mat-spinner>
  </div>
</mat-dialog-content>

./mat-async-dialog.component.scss

.title {
  font-size: 20px;
  margin-top: 16px;
  margin-bottom: 16px;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""