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

ng-toast-stack

v1.0.5

Published

Beautiful & easy to use toast stack messages, having auto close, pause, resume functionality and customization.

Downloads

61

Readme

ng-toast-stack

An Angular module for beautiful & easy to use toast stack messages, having auto close, pause, resume functionality and complete customization ability...

demo

Installation

NPM:

npm i ng-toast-stack

Importing in project

Step 1 -- Import NgToastStackModule in the module you want to use it, For e.g, in app.module.ts

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgToastStackModule } from 'ng-toast-stack';

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

NOTE- You'll need to import BrowserAnimationsModule in module you are using ng-toast-stack to have smooth animations.

Step 2 -- Add <ng-toast-stack></ng-toast-stack> on top of root component of the module you have imported NgToastStackModule in, for e.g. in app.component.html -- This component is used to display toast notifications

<ng-toast-stack></ng-toast-stack>
...

NOTE- The default z-index value is 1000 to show toast notification on top of everything on the page. To override, you can modify its class.

Usage

To push toast notification from any component, you need to inject NgToastStackService in that component's .ts file, for e.g. app.component.ts and then you may call it from html or component file depending on your need.

import { Component } from '@angular/core';
import { NgToastStackService } from 'ng-toast-stack';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  ...
  constructor(private toast: NgToastStackService) {}
  // To access toast in html file, set it to public instead of private
  ...
}

Example

-- SIMPLE WAY: Pass your message as string as argument

example() {
    this.toast.push('Example toast message')
}

-- SUCCESS:

this.toast.success('Example toast message') 

-- ERROR:

this.toast.error('Example toast message')

-- STATIC: (Doesn't closes automatically)

this.toast.static('Example toast message')

-- WITH CUSTOM OPTIONS: Pass object with atleast msg property as argument

example(){
    this.toast.push({
        title: 'Example Toast' // title of the toast
        msg: 'This is Toast message that will be displayed', // message of the toast
        type: 'error', // type of toast
        autoCloseTimer:6000, // closes after 6 seconds
    })
}

NOTE- Only msg property must be sent to show toast message. Other properties have default values set (see table).

TOAST OPTIONS

msg property is required

Keys

| Name | Type | Default | Possible Values | Description | | ----------------- | ------- | ------- | ----------------- | ----------------------------------------------------------------------------- | | type | string | success | success / error | This is the type of toast notification, the Icon is shown based on type. | | title | string | Success | - | Title of the toast notification. | | msg | string | - | - | Message of the toast notification. | | autoClose | boolean | true | true / false | If false, toast will not close automatically. | | autoCloseTimer | number | 5000 | - | The duration after which toast should be closed. | | pauseOnHover | boolean | true | true / false | If false, toast timer will not get paused on mouse-over event. |

CREDITS

I would like to share credits for icon and design inspiration. -- The toast notification and complete design is inspired by one of Tailwindcss UI official tutorial on youtube. -- The Error notification icon is used from hero icons -- The animated Success icon was searched from google. but I'm unable to find the actual author. If you are the real author of Success icon svg please let me know, I'll update.