npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

notify-toaster

v0.0.4

Published

Toaster notification component provides a sleek and efficient way to display alert messages in your Angular application.

Downloads

49

Readme

Notify

This library was generated with Angular CLI version 17.1.0.

Angular Notification Toaster Module (notify-toaster)

The library provides a notification which is written in Angular and it is dependent on native angular

Guide:

  1. Install the notify-toaster using npm npm install notify-toaster
  • Note : Use the regular npm flags such as - --save to include under dependencies in package.json. - -g to install it globally

  1. Add NotifyModule to AppModule by importing it from notify-toaster package
    import { NotifyModule } from 'notify-toaster';
    
    @NgModule({
      imports: [NotifyModule],
      ...
    })
    export class AppModule {
    }

  1. As this library uses Angular animations. BrowserAnimationsModule should also be imported to the app.module.
  • Note : Further exploration of @angular/animations module can be referred here, official documentation.
   import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

   @NgModule({
     imports: [BrowserAnimationsModule],
     ...
   })
   export class AppModule {
   }

  1. Create a placeholder for the app-notify-container componenet in your app.component.html
    <app-notify-container></app-notify-container>

  1. Inject the NotifyService into your component
    constructor(private notifyService: NotifyService) { }

  1. The toast message configuration contains following properties

|Property | Data Type | Mandatory | Default Value | Usage | | ------------ | ---------- | -------------- | --------------------- | ---------------------------------------------- | | id | string | No | ---------- | Auto generated for each notification | | message | string | Yes | ---------- | The user defined toast message | | autoHide | boolean | No | true | This will hide the message | | displayDuration | number | No | 5000(milli seconds) | Timeout Duration can be set using this property | | showCloseButton | boolean | No | true | Close button can be seen for manually closing it | | toastType | ToastType | Yes | ---------- | Type of the toast message can be set htere |

  • where ToastType is a enumeration type that determines the type of the notification which takes a five values viz.,
    • success
    • update
    • warning
    • info
    • delete

  1. To show the toast message you should be calling the show() method that takes only two argument, type of notification and messsage
pushSuccess() {
  this.notification.show('success', 'This is a success alert');
}

  1. To manually close a particular toast message set the autoHide property as false and showCloseButton property as true which displays a close button using which the message can be manually closed.


  1. To show multiple notification messages you can call the show() multiple times by configuring the notification object as you wish
pushSuccess() {
  this.notification.show('success', 'This is a success notification');
}
pushUpdate() {
  this.notification.show('update', 'This is a update notification');
}
pushWarn() {
  this.notification.show('warning', 'This is a warning notification');
}
pushInfo() {
  this.notification.show('info', 'This is a info notification');
}
pushDelete() {
  this.notification.show('delete', 'This is a delete notification');
}

For LIVE DEMO checkout the notify-toaster