angular-toastr
angular-toastr copied to clipboard
Multiple Containers? Scope of Toasts? Dynamic Container Selector?
I have attempted to create an AngularJS Service that handles the interaction with Toastr. This service would allow the change of target containers for different scenarios. Different scenarios include Global Messaging (happens when on any page based on a service outage/etc) and per page (where the messages in the "page" scope are removed when route changes or on a "clear changes" event).
I have attempted to inject the toasterConfig into the service and change the target before I initiate the toast (toasterConfig.target = "#newSelector"). However I found that if this selector is a dynamic element (ui-view) then the toasts work for the first event but not for the next toast (it still fires as you can see console logs happen, but nothing appears.)
So I guess the issue is -
Can you have multiple containers? (I cannot seem to make it work)
Can you have scoped containers? or can the selector be Dynamically created such at
You can't have multiple containers right now, sadly. That is something I want to fix on the future.
The .target functionality would match anything with .querySelector so see if you can select what you need using that function. It is personally a functionality I never used, added it because someone wanted it.
I am repeating a lot my TODO lately, but I maintain lots of open source projects and that is a hard work.
The scoped containers, I am not entirely sure if I follow the idea tho.
Scoped container would be the idea that each message being toasted would have a scope applied to them (ie, tag) so that if you initiated a clear it would only clear the tag specified allowing you to have a single container but manage the messages that are being placed in/removed with human readable logic instead of loops+filters on the open toasts.