GithubHelp home page GithubHelp logo

scenius-software / angular-toastify Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 3.0 7.26 MB

A somewhat minimalistic clone of React Toastify.

JavaScript 2.07% TypeScript 50.16% HTML 22.32% CSS 0.24% SCSS 25.20%
angular toast toastify notification toastservice

angular-toastify's Introduction

npm npm NPM

Angular Toastify

A somewhat minimalistic clone of React Toastify.

This project was build on Angular version 12.0.5

Demo!

Typical setup and usage

Import package:

npm i angular-toastify

Add to app.module.ts:


import { ToastService, AngularToastifyModule } from 'angular-toastify'; 

@NgModule({
  declarations: [...],
  imports: [
    ...
    AngularToastifyModule,
    ...
  ],
  providers: [ToastService],
  bootstrap: [...]
})
export class AppModule { }

Add to any component within visible layout:

<lib-toastify-toast-container></lib-toastify-toast-container>

Toast container options (optional)

<lib-toastify-toast-container 
[position]="'top-left' | 'top-right' | 'bottom-right' | 'bottom-left'"  (default: 'top-right')
[transition]="'bounce' | 'slide' | 'zoom' | 'flip'" (default: 'bounce)
[autoClose]="time in ms (0 = disabled)" (default: 5000)
[hideProgressBar]="true | false"  (default: false)
[newestOnTop]="true | false"  (default: false)
[closeOnClick]="true | false" (default: true)
[pauseOnHover]="true | false" (default: true)
[pauseOnVisibilityChange]="true | false"  (default:  true)
[iconLibrary]="'material' | 'font-awesome' | 'none';"  (default: 'none')

></lib-toastify-toast-container>

Add to component or service:

 constructor(private _toastService: ToastService) { }

 addInfoToast() {
    this._toastService.info('message');
 }

Changelog

1.0.6
  • Add Ivy support
1.0.5
  • Added a new property preventDuplicates on the Toastify Container. When set to true, toasts with identical texts will no longer create duplicates, but should instead increase the time the already present toast will be on visible on the screen. Credits go to @JoranLive for implementing this feature.
1.0.4
  • Module no longer imports BrowserModule. Angular Toastify can now be used in submodules.
  • Updated to Angular 12
1.0.2
  • Run toast outside Angular so they do not delay Protractor tests.

angular-toastify's People

Contributors

dependabot[bot] avatar joran-github avatar joranlive avatar lerke avatar nickhes avatar sc-willem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

angular-toastify's Issues

Prevent duplicated

Hello,

May it be a good idea to add an option to avoid duplicated toast?

Idea:
In "ToastifyToastContainerComponent" add an input: "@input() preventDuplicated = false;"
After receiving "toastAddedEvent", we check if a toast if same text already exist. If yes: we update the toast time to keep it 5s more.

If you are OK with this proposal, I can do it.

Angular Ivy Compatibility?

After importing the module in some module of my application, it throws an error:

AngularToastifyModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

I was able to fix it by setting aot: false in angular.json, but is there some other fix for this other than that?

Coudn't use in a submodule

Works in app module but not in sub-module. Throwing following error, "BrowserModule has already been loaded"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.