1

In App.module:
import ToastrModule in appModule

ToastrModule.forRoot({
  timeOut: 3000,
  preventDuplicates: true,
}),

In inner component

this.toastr.error("test err");

it is taking time to display, arount 30 to 40 sec.

Dhara Tank
  • 11
  • 2
  • 2
    Could you please replicate it in a stackblitz demo app? Not enough information to help you. – Leonardo Freire Dec 16 '21 at 14:40
  • Please, replicate it in Stackblitz or share a repo where we can replicate that behavior. – Daniel Guzman Dec 16 '21 at 22:47
  • it is working fine when I have create a demo application. It is not can be regenerate in demo app or in stackblitz. – Dhara Tank Dec 17 '21 at 06:12
  • Even It is taking time on OnInit as well. after display the toastr message it is not closing it self. even i have added timeOut: 3000, I need to close it manually. – Dhara Tank Dec 17 '21 at 06:17
  • Your shared code seems to be working fine, something else might be interferering with your toastr. – Nils Kähler Dec 23 '21 at 10:37
  • I got the issue, and resolved it, AfterContentChecked hook performing operation on few controls. so it was delay the toaster. Thank you. – Dhara Tank Dec 29 '21 at 04:55

1 Answers1

0

I manage to configure the time Toaster message displays using the following configuration

import { ToastrModule } from 'ngx-toastr';

@NgModule({
  declarations: [
    .....
  ],
  imports: [
    ....,
    ToastrModule.forRoot({ timeOut: 7500, 
                           extendedTimeOut: 7500, 
                           preventDuplicates: true })
  ],
})
  • timeOut - toast time to live in milliseconds default: 5000
  • extendedTimeOut - time to close after a user hovers over toast default: 1000