error when trying to run a notification with ng-snotify

3

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?

    
asked by Pablo Contreras 28.09.2018 в 23:52
source

1 answer

5

You just need to add in% html <ng-snotify class="{{style}}"></ng-snotify> according to the example they have here .

    
answered by 01.10.2018 / 15:26
source