Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add button click + event on a toater? #74

Closed
liadlivnat opened this issue Apr 15, 2015 · 4 comments
Closed

How to add button click + event on a toater? #74

liadlivnat opened this issue Apr 15, 2015 · 4 comments

Comments

@liadlivnat
Copy link

i'm trying to do the following:

toastr.warning("message message. <input class='undo-button' type='text' value='Undo' data-ng-click='callback()' />",
                {
                    callback: function()
                    {
                        console.log("here");

                    }
                });

It's not working, any suggestion how to add a callback function from a toaster?

@Foxandxss
Copy link
Owner

Check the README. You can add the onHidden callback so when it gets closed, it gets called. You can also check in there if it was closed by itself or via click.

You can't add directives into the message, that is pretty dangerous so I don't allow that.

@liadlivnat
Copy link
Author

This is not the case since onHidden will call a function once the message will be close and,
i want to add my own callback when somone click on button inside the toastr

i added a button inside the template

<input class='undo-button' type='text' value='Undo' data-ng-click='callback()'

@Foxandxss
Copy link
Owner

You can't do that with this library. Supporting directives inside the toasts is highly insecure and can open a door for injections.

I had to decide to not allow that. Sorry.

@SaiPhaniKnappily
Copy link

SaiPhaniKnappily commented Jul 3, 2017

@Foxandxss I am wondering are you allowing anchorScroll in toastr? I am trying to navigate to a section in my current screen with the toastr message. Can someone help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants