File

src/app/loader/full-page-loader/full-page-loader.component.ts

Implements

OnInit

Metadata

selector full-page-loader
styleUrls full-page-loader.component.css
templateUrl full-page-loader.component.html

Index

Properties
Methods

Constructor

constructor(loader: LoaderStore, material: MaterialService)
Parameters :
Name Type Optional
loader LoaderStore no
material MaterialService no

Methods

close
close()
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

model
model:
Default value : new LoaderModel()
import { Component, OnInit } from '@angular/core';
import { LoaderModel } from '../../models/loader.model';
import { LoaderStore } from '../../stores';
import { MaterialService } from '../../services';

@Component({
  // tslint:disable-next-line:component-selector
  selector: 'full-page-loader',
  templateUrl: 'full-page-loader.component.html',
  styleUrls: ['full-page-loader.component.css']
})
export class FullPageLoaderComponent implements OnInit {
  model = new LoaderModel();
  constructor(private loader: LoaderStore, private material: MaterialService) {}

  ngOnInit() {
    this.loader.isVisible$.subscribe(isVisible => {
      this.model.setVisibility(isVisible);
      if (isVisible) {
        this.material.render();
      }
    });

    this.loader.isSuccess$.subscribe(message => {
      this.model.success(message);
    });

    this.loader.isError$.subscribe(message => {
      this.model.error(message);
    });
  }

  close() {
    this.model.close();
  }
}
<div *ngIf="model.visibility === model.states.visibility.VISIBLE" (click)="close()" class="backdrop">
    <div class="mdl-grid no-spacing">
        <div *ngIf="model.completion === model.states.completion.NONE" class="mdl-cell mdl-cell--12-col center">
            <div class="mdl-spinner mdl-js-spinner is-active"></div>
            <br />
            <h6 class="loading-text off-white">{{model.message}}</h6>
        </div>
        <div *ngIf="model.completion === model.states.completion.SUCCESS" class="mdl-cell mdl-cell--12-col center result-icon">
            <i class="material-icons lg-font complete-icon">check_circle</i>
            <h6 class="off-white">
                <pre class="material-font">{{model.message}}</pre>
            </h6>
        </div>
        <div *ngIf="model.completion === model.states.completion.ERROR" class="mdl-cell mdl-cell--12-col center result-icon">
            <i class="material-icons lg-font fail-icon">error</i>
            <h6 class="off-white">
                <pre class="material-font">{{model.message}}</pre>
            </h6>
            <h5 class="subtext"><small>click anywhere to close</small></h5>
        </div>
    </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""