4

I have installed ngx-toastr and imported in app.module.ts but getting this error while compiling enter image description here...is it because i have set the properties of toaster in service file which I created like below?enter image description here

I tried adding @import '~ngx-toastr/toastr.css'; in styles.css still no effect. Does anyone know what might be the reason for this error and how to fix it

KiG
  • 41
  • 1
  • 3
  • You should provide some more input - how you import he module in app.module.ts, version of angular and toastr module. It could be some incompatible versions. Normally I add config for toastr in app.module.ts: ToastrModule.forRoot({ timeOut: 0, tapToDismiss: false, closeButton: true, extendedTimeOut: 0, enableHtml: true }), – Drazu Nov 24 '22 at 12:59
  • 1
    I get the same error with Angular 14. – cjs1978 Nov 24 '22 at 13:05
  • 1
    @cjs1978 same for me with Angular 14. Downgrading to 15.0.2 works – Brandon Taylor Nov 25 '22 at 21:22

2 Answers2

12

you should try to uninstall your current version ngx-toastr, then try to install another version, I installed version 15.2.0 npm install --save ngx-toastr@15.2.0, that works for me.

  • 1
    Good answer, you should edit it though to be more readable. Put the command in code brackets for easy copy-paste. `npm install --save ngx-toastr@15.2.0` – Kyriakos Xatzisavvas Nov 25 '22 at 23:41
0

This version worked for me "ngx-toastr": "^14.2.1",