First of all: Very nice piece of software!
Now what confused me:
ToastrModule.forRoot(
{
iconClasses: {
error: 'toast-error-ABC'
}
}
)
does not work as expected - keeps the default value 'toast-error'
as can be seen in src/app.ts here:
https://embed.plnkr.co/ABCkco3p3JYYeBEXxiNA/
export class AppModule {
constructor(toastrConfig: ToastrConfig) {
toastrConfig.iconClasses.error = 'toast-error-ABC';
}
}
works just fine - the default value is replaced with 'test-error-ABC'
as can be seen in src/app.ts here:
https://embed.plnkr.co/MQa4myRfs4GotrnOlLrZ/
If the first example can't work/is intentionally a little hint in the section "Override default settings" could save others some headscratching.
Cheers
Just quickly looking through the source. I believe the issue happens at https://github.com/scttcper/ngx-toastr/blob/master/src/lib/toastr/toastr-config.ts#L92-L95
The statements should probably be reversed so that it uses the passed in value, if it exists, instead of if the class property has a value (which is always true). I can't make a pull request until a bit later so if there still isn't one open I'll go ahead and open one when I'm able.
We looked at the sources as well - but since we are pretty new to TypeScript we obviously didn't look properly...
Thanks for taking care of it!
Most helpful comment
Just quickly looking through the source. I believe the issue happens at https://github.com/scttcper/ngx-toastr/blob/master/src/lib/toastr/toastr-config.ts#L92-L95
The statements should probably be reversed so that it uses the passed in value, if it exists, instead of if the class property has a value (which is always true). I can't make a pull request until a bit later so if there still isn't one open I'll go ahead and open one when I'm able.