You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed after switching from pure JS Toastr implementation over to Angular-Toastr that my new toasts were being added to the bottom of the list. This has an unfortunate side effect of making the fade-out look a little jumpy. I thought at first that changing this behavior would just be a matter of changing toastrConfig like...
toastrConfig.newestOnTop=true;
But this didn't seem to have any impact. Next I dug into the source code. Here's the relevant bit of the Toastr source:
functionaddToast(toast){// Hidden for brevityif(mergedConfig['newest-on-top']===true){scope.toasters.unshift(toast);// Hidden for brevity}else{scope.toasters.push(toast);// Hidden for brevity}
I'm not sure this is quite so straight forward to implement in your version of Toastr because of how you're using $animate.enter but I think a similar thing could be accomplished by making the following two changes:
Assign a placeholder first child in setContainer
container=angular.element('<div><i></i></div>');// <i> could be any other inline element
Check toastrConfig and parent the new toast appropriately in _notify
_setContainer(options).then(function(){varafter=toastrConfig.newestOnTop ? container.find('i') : null;// You could change the default$animate.enter(newToast.el,container,after,function(){
Any chance you could make this change?
PS. For what it's worth, I tested this change locally and it seems to work. I'll submit a PR shortly.
The text was updated successfully, but these errors were encountered:
bvaughn
pushed a commit
to bvaughn/angular-toastr
that referenced
this issue
Aug 11, 2014
I noticed after switching from pure JS Toastr implementation over to Angular-Toastr that my new toasts were being added to the bottom of the list. This has an unfortunate side effect of making the fade-out look a little jumpy. I thought at first that changing this behavior would just be a matter of changing
toastrConfig
like...But this didn't seem to have any impact. Next I dug into the source code. Here's the relevant bit of the Toastr source:
I'm not sure this is quite so straight forward to implement in your version of Toastr because of how you're using
$animate.enter
but I think a similar thing could be accomplished by making the following two changes:Assign a placeholder first child in
setContainer
Check
toastrConfig
and parent the new toast appropriately in_notify
Any chance you could make this change?
PS. For what it's worth, I tested this change locally and it seems to work. I'll submit a PR shortly.
The text was updated successfully, but these errors were encountered: