Open shyamal890 opened 8 years ago
my recommendation is that you $templateCache the template before you use it.
Can't this work without caching the template? I have separate logic that triggers caching process for release build. This may create a conflict.
The official recommendation from angular is to provide the templates already cached. The problem here is that you won't get a valid toast the first time you use it (because the toast will be shown before the template gets fetched) and there is no way around that for this kind of widgets.
@Foxandxss Check this plunker. I tried creating toast more than 2 times, custom-template is not rendered.
http://plnkr.co/edit/FuXKAPkmOOM1IcqNRuIs?p=preview
May be I am doing something wrong.
Custom templates can't be changed on the toast, needs to be changed on toastrConfig
.
Oh, that means I can only set one template at a time. I would like to render different templates for different toasts.
I also tried to set a custom template, only to detect that the options "iconClasses" and "templates" are considered "bad Options" and are deleted in cleanOptionsOverride(options)
Cost me >two hours to find the real problem.
I am trying to set one toast with a custom template. This would mean I'll have to add a lot more ng-ifs and ng-selects to the standard template to incorporate all possibilities :-(
Please update the documentation; it now clearly says "The second option is to pass a third parameter". I have searched in vain for a hint that "templates" or "iconClasses" cannot be used for the second option.
I suggest you add "(can only be used toastConfig
)" to the documentation of these two options.
I would like to dynamically change the toast template. Using the following code doesn't work, renders the same template: