Loading repository dataβ¦
Loading repository dataβ¦
jdjuan / repository
π» A dead simple notification library for Angular π»
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
To install this library, run this command in your Angular application:
$ npm install ng-notyf --save
If you use Angular 2 you should already have @angular/animations package installed, but if you use Angular 4, you might not, so don't forget to install it:
$ npm install @angular/animations --save
ng-notyf into you app.moduleimport { NotyfModule } from 'ng-notyf';
@NgModule({
imports: [
NotyfModule
],
declarations: [...],
exports: [...],
providers: [...]
})
ng-notyf service into your componentimport { NotyfService } from 'ng-notyf';
export class myComponent {
constructor(
private notyfService: NotyfService
) { }
}
alert() {
this.notyfService.success("π»π»π» It just works! π»π»π»");
this.notyfService.error("Something went wrong π°π°π°");
}
// The toast now lasts 8 seconds
this.notyfService.toastDelay = 8000;
// Change background and font color
this.notyfService.toastStyle = { 'background-color': 'purple', 'color': 'white' };
// Notification now displayed in the left corner
this.notyfService.toastContainerStyle = { 'left': '0' };
We got you covered π Ng-notyf uses the Web Animations API so you just have to install this package:
$ npm install web-animations-js --save
And add these to your polyfills.ts file:
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';
/** IE10 and IE11 requires the following to support `@angular/animation`. */
import 'web-animations-js';
MIT Β© Juan Herrera and Carlos Roso