0

I am using John Papa's Teastr library for notifications for my angular project. Is there any configuration provided by the library that can be configured to turn on or off the toasts. I tried looking into the API, but couldn't find anything.

One way is to have some flag, but then that piece of code may have to be included every time. Are there any other ways to accomplish this?

Vemonus
  • 868
  • 1
  • 16
  • 28
Vatsal
  • 2,068
  • 4
  • 21
  • 24
  • I would suggest to use the Toastr as a Factory. You can set the environment flag inside the factory (if you're using grunt, it will be easier setting that flag). – Iliya Reyzis Nov 25 '15 at 09:32
  • nice suggestion. I am fairly new to angular so need to see how to integrate it with grunt. But yes, I kind of got the point. Thanks – Vatsal Nov 25 '15 at 09:40
  • you welcome. btw, just to make clear myself, by saying "set the environment flag inside the factory", I meant read the environment variable from a module (considering you're creating the variable in a configurations module with grunt). – Iliya Reyzis Nov 25 '15 at 09:50

1 Answers1

0

// turn off

toastr.options.target = null

// turn on

toastr.options.target = 'body'

See How to easily switch off Toastr JS

Community
  • 1
  • 1
user6403833
  • 269
  • 5
  • 13