File

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

Implements

OnInit

Metadata

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

Index

Properties
Methods

Constructor

constructor(dialogRef: MatDialogRef, data: MatLoadingDialogData)
Parameters :
Name Type Optional
dialogRef MatDialogRef<MatLoadingDialog> No
data MatLoadingDialogData No

Methods

ngOnInit
ngOnInit()
Returns : void

Properties

color
Type : ThemePalette
Public data
Type : MatLoadingDialogData
Decorators :
@Optional()
@Inject(MAT_DIALOG_DATA)
Public dialogRef
Type : MatDialogRef<MatLoadingDialog>
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 MatLoadingDialogData {
  title?: string;
  icon?: string;
  color?: ThemePalette;
}

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

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

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

  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-loading-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 ""