Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ng2-yk-notifier
Advanced tools
Readme
Install ng2-yk-notifier using npm:
npm install ng2-yk-notifier --save
Add NotifierModule into your AppModule class. app.module.ts
would look like this:
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent} from './app.component';
import {NotifierModule} from 'ng2-yk-notifier';
@NgModule({
imports: [BrowserModule, NotifierModule.forRoot()],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {
}
Inject 'NotifierService' class in your component class.
import { Component, OnInit, ViewContainerRef } from "@angular/core";
import { NotifierService } from 'ng2-yk-notifier';
@Component({
selector: 'awesome-component',
template: '<button class="btn btn-default" (click)="showSuccess()">Notifier Tester</button>'
})
export class AppComponent implements OnInit {
constructor( private notifier: NotifierService,
private vRef: ViewContainerRef ) {
}
ngOnInit(): void {
this.notifier.setRootViewContainerRef(this.vRef);
}
showSuccess() {
this.notifier.success('You are awesome!', 'Success!');
}
showError() {
this.notifier.error('This is not good!', 'Oops!');
}
showAlert() {
this.notifier.alert('You are being warned.', 'Alert!');
}
showInfo() {
this.notifier.info('Just some information for you.');
}
}
By default, the notifier will show up at bottom right corner of the page view, and will automatically dismiss in 3 seconds. You can configure the notifiers using NotifierOptions class. Currently we support following options:
Determines how long an auto-dismissed notifier will be shown. Defaults to 3000 miliseconds. If you set it to 0, the notifier will not auto-dismiss.
Determines maximum number of notifiers can be shown on the page in the same time. Defaults to 5.
Determines where on the page the notifier should be shown. Here are list of values:
CSS class for content within notifier.
CSS class for title within notifier.
You have following choice: 'fade', 'flyLeft' or 'flyRight'.(Defaults to 'fade')
Use dependency inject for custom configurations. You can either inject into app.module.ts
or any component class:
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent} from './app.component';
import {NotifierModule, NotifierOptions } from 'ng2-yk-notifier';
let options: NotifierOptions = new NotifierOptions({
animate: 'flyRight',
position: ['top', 'right'],
notifierLife: 4000
});
@NgModule({
imports: [
BrowserModule,
NotifierModule.forRoot(options),
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {
}
You can also override notifierLife
, titleClass
, messageClass
, animate
, options for individual notifier:
this.notifier.sucess('This notifier will dismiss in 10 seconds.', null, {notifierLife: 10000});
this.notifier.info('This notifier will have "new-title" class in its title', null, {titleClass: 'new-title'});
FAQs
Angular2 Notification Component
The npm package ng2-yk-notifier receives a total of 15 weekly downloads. As such, ng2-yk-notifier popularity was classified as not popular.
We found that ng2-yk-notifier 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.