File

src/app/shared/services/notification.service.ts

Description

A service for global notifications. Allows to push success, error, warning and info notification

Example

Index

Methods

Constructor

constructor(toastrService: ToastrService)
Parameters :
Name Type Optional Description
toastrService ToastrService

Methods

error
error(message: )
Parameters :
Name Type Optional Description
message
Returns : void
info
info(message: )
Parameters :
Name Type Optional Description
message
Returns : void
success
success(message: )
Parameters :
Name Type Optional Description
message
Returns : void
warning
warning(message: )
Parameters :
Name Type Optional Description
message
Returns : void
import { Injectable } from '@angular/core';
import { ToastrService } from 'ngx-toastr';

/**
 * A service for global notifications.
 * Allows to push success, error, warning and info notification
 *
 * @author Damien Vitrac
 */
@Injectable()
export class NotificationService {

  constructor(private toastrService: ToastrService) {
  }

  success(message) {
    this.toastrService.success(message);
  }

  info(message) {
    this.toastrService.info(message);
  }

  error(message) {
    this.toastrService.error(message);
  }

  warning(message) {
    this.toastrService.warning(message);
  }

}

results matching ""

    No results matching ""