![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
ng2-toasty
Advanced tools
Angular2 Toasty component shows growl-style alerts and messages for your app.
Angular2 Toasty component shows growl-style alerts and messages for your application.
Simple examples using ng2-toasty:
Online demo available here
First you need to install the npm module:
npm install ng2-toasty --save
If you use SystemJS to load your files, you might have to update your config with this if you don't use defaultJSExtensions: true
:
System.config({
packages: {
"/ng2-toasty": {"defaultExtension": "js"}
}
});
Finally, you can use ng2-toasty in your Angular 2 project:
ToastyService, ToastyConfig, Toasty, ToastOptions
from ng2-toasty/ng2-toasty
ToastyService, ToastyConfig
in the bootstrap of your application;Toasty
to the "directives" property of your application component;<ng2-toasty></ng2-toasty>
tag in template of your application component.import {Component} from 'angular2/core';
import {ToastyService, ToastyConfig, Toasty, ToastOptions, ToastData} from 'ng2-toasty/ng2-toasty';
import {bootstrap} from 'angular2/platform/browser';
bootstrap(AppComponent, [
ToastyService, ToastyConfig // It is required to have 1 unique instance of your service
]);
@Component({
selector: 'app',
directives: [Toasty],
template: `
<div>Hello world</div>
<button (click)="addToast()">Add Toast</button>
<ng2-toasty></ng2-toasty>
`
})
export class AppComponent {
constructor(private toastyService:ToastyService) { }
addToast() {
// Just add default Toast with title only
this.toastyService.default('Hi there');
// Or create the instance of ToastOptions
var toastOptions:ToastOptions = {
title: "My title",
msg: "The message",
showClose: true,
timeout: 5000,
theme: 'default'
onAdd: (toast:ToastData) => {
console.log('Toast ' + toast.id + ' has been added!');
},
onRemove: function(toast:ToastData) {
console.log('Toast ' + toast.id + ' has been removed!');
}
};
// Add see all possible types in one shot
this.toastyService.info(toastOptions);
this.toastyService.success(toastOptions);
this.toastyService.wait(toastOptions);
this.toastyService.error(toastOptions);
this.toastyService.warning(toastOptions);
}
}
Inspired by angular-toasty
FAQs
Angular2 Toasty component shows growl-style alerts and messages for your web app
The npm package ng2-toasty receives a total of 1,242 weekly downloads. As such, ng2-toasty popularity was classified as popular.
We found that ng2-toasty demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.