Using this library
Execute the command:
npm install ng-snotify
Add the css to angular.json :
"node_modules / ng-snotify / styles / material.css",
My app.module.ts : - Import it like this:
import {SnotifyModule, SnotifyService, ToastDefaults} from 'ng-snotify';
- declare it in import like this:
SnotifyModule,
- also add it to the providers :
providers: [ {provide: 'SnotifyToastConfig', useValue: ToastDefaults}, SnotifyService ],
In my ts :
- I import it like this:
import { Snotify, SnotifyService } from 'ng-snotify';
- in the constructor I declare it like this:
private service: SnotifyService
- I try to call a notification with a function like this:
showSuccess() {
console.log('showSuccess');
this.service.success('Example body content', 'Example Title');
}
But this does not show anything on the screen. Nothing, only the impression by console, but nothing of notification, nor an error. Why?