Skip to content

fortesl/lf-angular-toastr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An angular module wrapper service for the Foxandxss angular-toasts

Install

bower install lf-angular-toastr

USAGE

Include the following resources in your html file:

    <link rel="stylesheet" href="bower_components/angular-toastr/dist/angular-toastr.css">
    <script src="bower_components/angular-animate/angular-animate.js"></script>
    <script src="bower_components/angular-toastr/dist/angular-toastr.tpls.js"></script>
    <script src="bower_components/lf-angular-toastr/lf-angular-toastr.js"></script>

Add also to your Angular controller like below:

    var myApp = angular.module('myApp', ['lf-toastr']);
    myApp.controller('MyController', ['lfToastrService', function(lfToastrService) {

        //call methods here as per API below

    });

API

Below are the available methods and examples on how to use them

  1. thereAreOpenedToasts returns true if there are toasts, returns false otherwise
    • Example: if (lfToastrService.thereAreOpenedToasts() { ... do something ... }
  2. clearToasts removes all opened toasts
    • Example: lfToastrService.clearToasts();
  3. toastIsOpened returns true if a toast (defined by the message string) is opened, returns false otherwise
    • Example: if (lfToastrService.toastIsOpened('I love toasts') { ... do something ... }
  4. openToast opens a toast, given a message string, a title string, and an optional config object
    • Example: lfToastrService.openToast('I love toasts', 'TOAST ME', {type: 'success'});
  5. clearToast removes a toast, given a message string
    • Example: lfToastrService.removeToast('I love toasts');

The default configuration used by lf-angular-toastr is shown below:

    toastDefaultOptions = {
        positionClass: 'toast-bottom-right',
        tapToDismiss: false,
        timeOut: 0,
        extendedTimeOut: 0,
        type: 'error'
    };

This configuration can be modified by the optional config object passed into the method openToast().

DOCUMENTATION

Find more information on all the possible configuration options and usage examples here: Foxandxss angular-toasts

About

An angular module wrapper service for the Foxandxss angular-toasts

Resources

Stars

Watchers

Forks

Packages

No packages published