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

ngx-toastf

v1.2.1

Published

A package to show toast alert in angular apps

Downloads

36

Readme

NgxToastf

Features

  • Toast Component Injection without being passed ViewContainerRef
  • Animations using Angular's

Dependencies

Latest version available for each version of Angular

| ngx-toastf | Angular | |------------|-------------| | 1.0.0 | 9.x 8.x 7.x |

Install

npm install ngx-toastf --save

@angular/animations package is a required dependency for the default toast

npm install @angular/animations --save

Setup

step 1: Add NgToastModule to appModule, make sure you have BrowserAnimationsModule as well

import { CommonModule } from '@angular/common';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { ToastrModule } from 'ngx-toastf';

@NgModule({
  imports: [
    CommonModule,
    BrowserAnimationsModule, // required animations module
    NgToastModule // ToastrModule added
  ],
  bootstrap: [App],
  declarations: [App]
})
class MainModule {}

step 2: Add icons styles to angular.json file in styles array

"styles": [
  // other styles
  "./node_modules/ngx-toastf/src/assets/fontello/css/all.min.css"
],

Use

import { ToastrService } from 'ngx-toastf';

@Component({...})
export class YourComponent {
  constructor(private toastService: NgToastService) {}

  showToastSuccess() {
    this.toastr.showToastSuccess('Hello world!', { title: 'Test!' });
  }
}

Options

There are global options.

Global Options

Global options include the following options:

| Option | Type | Default | Description | |-------------|---------|---------------------------------|-------------------------------------------| | title | string | null | Title for toast message | | position | object | see below | Toast container position | | duration | number | 3000 | Time to live in milliseconds | | closeButton | boolean | false | Show close button | | tapDismiss | boolean | false | Close on click | | autoClose | boolean | true | Dismiss current toast when max is reached |

position defaults
NgToastPosition {
    BottomCenter = 0,
    BottomFullWidth = 1,
    BottomLeft = 2,
    BottomRight = 3,
    TopCenter = 4,
    TopFullWidth = 5,
    TopLeft = 6,
    TopRight = 7,
    Center = 8
};

Styles

Global Styles

| Class | Description | |-----------------------|-------------------------------------------| | toast-container | Toast container | | toast-container-title | Toast container title, and symbol | | toast-container-body | Toast container for message |

Toast type styles

For customizations styles you can overwrite those classes:

  • .toast-container-success
  • .toast-container-info
  • .toast-container-warning
  • .toast-container-error
  .toast-container {
    &-success {
      background-color: green !important;
    }
    &-error {
      background-color: pink !important;
    }
}

License

MIT


GitLab @darioegb  ·