Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
ng6-toastr-notifications
Advanced tools
NOTE : Tested with Angular v6.0.0 and Angular-Cli v6.0.0.
Install ng6-toastr-notifications using npm:
npm install ng6-toastr-notifications --save
Add ToastrModule into your AppModule class. app.module.ts
would look like this:
Take Note : For Toastr Animations working perfectly please import BrowserAnimationsModule into app.module.ts file.
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { ToastrModule } from 'ng6-toastr-notifications';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, BrowserAnimationsModule, ToastrModule.forRoot()],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
Inject 'ToastsManager' class in your component class.
import { Component } from '@angular/core';
import { ToastrManager } from 'ng6-toastr-notifications';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor(public toastr: ToastrManager) {}
showSuccess() {
this.toastr.successToastr('This is success toast.', 'Success!');
}
showError() {
this.toastr.errorToastr('This is error toast.', 'Oops!');
}
showWarning() {
this.toastr.warningToastr('This is warning toast.', 'Alert!');
}
showInfo() {
this.toastr.infoToastr('This is info toast.', 'Info');
}
showCustom() {
this.toastr.customToastr(
'<span style='color: green; font-size: 16px; text-align: center;'>Custom Toast</span>',
null,
{ enableHTML: true }
);
}
showToast(position: any = 'top-left') {
this.toastr.infoToastr('This is a toast.', 'Toast', {
position: position
});
}
}
By default, the toastr will show up at top right corner of the page view, and will automatically dismiss in 3 seconds. You can configure the toasts using ToastOptions class. Currently we support following options:
Determines how long an auto-dismissed toast will be shown. Defaults to 5000 miliseconds.
Determine how a displayed toaster can be dismissed. Allowed values are: 'auto', 'click', 'controlled' (value should all be lowercase).
toastTimeout
). This is default value.Determines whether new toast should show up on top of previous toast Defaults to false.
Determines whether toast should include 'x' close button. Defaults to false.
Determines maximum number of toasts can be shown on the page in the same time. Defaults to 5.
Determines where on the page the toasts should be shown. Here are list of values:
CSS class for message within toast.
CSS class for title within toast.
You have following choice: 'slideFromLeft', 'slideFromRight' or 'slideFromTop'.
animate: null
to disable animations.Allow input of message to be HTML. Default to false.
[Ng6 Toastr Notification Demo Link] (http://technoidlab.com/demos/ng6-toastr-notifications)
> cd demo/ngcli && npm install
> ng serve
Then navigate your browser to http://localhost:4200
> cd demo/webpack && npm run install
> npm run build
> npm start
FAQs
Angular 6 Toaster Notifications Module ===================
We found that ng6-toastr-notifications 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.