angular - angular2 toaster - No Toaster Containers have been initialized to receive toasts -


i using angular2-toaster in angular app

it simple,

you define toaster container in template of component

<toaster-container></toaster-container> 

and use toasterservice of type toasterservice pop op toaster

  this.toasterservice.pop('success', 'args title', 'args body'); 

but there problem approach, not define container in every component intend pop toaster, define once in root component. application bootstrap when so, error

 no toaster containers have been initialized receive toasts. 

any solution?

put <toaster-container></toaster-container> in root component view. inject toasterservice in each of other components. still able do:

  this.toasterservice.pop('success', 'args title', 'args body'); 

and don't forget provide toastservice @ module level.

demo


Comments

Popular posts from this blog

renaming files in a directory using python or R -

html - outline-style different in chrome compared to firefox and internet explorer -

ruby on rails - Carrierwave Timeout -