File

src/app/shared/components/blocker/blocker.service.ts

Description

Confirm Service.

Example

Index

Properties
Methods

Constructor

constructor(rendererFactory: RendererFactory2)

Constructor

Parameters :
Name Type Optional Description
rendererFactory RendererFactory2

Methods

lock
lock()

Lock

Returns : void
unlock
unlock()

Unlock

Returns : void

Properties

Private renderer
renderer: Renderer2
Type : Renderer2

Renderer

import { Injectable, Renderer2, RendererFactory2 } from '@angular/core';

/**
 * Confirm Service.
 *
 * @author Damien Vitrac
 */
@Injectable()
export class BlockerService {

  /**
   * Renderer
   */
  private renderer: Renderer2;

  /**
   * Constructor
   * @param rendererFactory
   */
  constructor(private rendererFactory: RendererFactory2) {
    this.renderer = rendererFactory.createRenderer(null, null);
  }

  /**
   * Lock
   */
  lock() {
    this.renderer.addClass(document.body, 'blocked');
  }

  /**
   * Unlock
   */
  unlock() {
    this.renderer.removeClass(document.body, 'blocked');
  }

}

results matching ""

    No results matching ""