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

Need a programmatic way to remove a toast #28

Closed
friksa opened this issue Jun 4, 2016 · 3 comments
Closed

Need a programmatic way to remove a toast #28

friksa opened this issue Jun 4, 2016 · 3 comments
Labels

Comments

@friksa
Copy link

friksa commented Jun 4, 2016

toasterService.pop returns a toast object.

I need a way to close / remove that toast at a later time when it is not applicable anymore. There might be multiple toasts displayed, but I need to remove a specific item.

For example, the toast may indicate that someone is requesting that their microphone is opened, but then change their mind. So it is important to remove the toast when it is not valid anymore.

@Stabzs
Copy link
Owner

Stabzs commented Jun 4, 2016

I might be missing something, but toasterService.clear does precisely this.

clear(toastId?: string, toastContainerId?: number)

Since you have the returned toast object, whenever you need to remove the toast, use that object's parameters to call clear.

var toast = toasterService.pop();
toasterService.clear(toast.toastId, toast.toastContainerId); 

@friksa
Copy link
Author

friksa commented Jun 4, 2016

Awesome! That was not documented on the github README, so I did not know :)

Thanks!

@friksa friksa closed this as completed Jun 4, 2016
@Stabzs
Copy link
Owner

Stabzs commented Jun 4, 2016

You are absolutely right, it is not! My apologies for that oversight.

I'll make sure to add an example in the near future. Thank you for pointing it out.

Stabzs added a commit that referenced this issue Jun 4, 2016
Added documentation for the clear function in toasterService in response
to #28.
@Stabzs Stabzs added the question label Jun 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants