-
Notifications
You must be signed in to change notification settings - Fork 97
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
Removing messsage from Controller #102
Comments
I second this idea. It might be easier to also have growl.clearAll(), which clears all visible notifications. I would want to use this after a state change with ui-router. |
With the latest version (0.7.5), you can do it by using the growlMessages service like this:
Note that on 0.7.3 there was an issue with the way destroyAllMessages looped over the messages internally, so that wouldn't work. |
The snippet posted by @fabiosussetto in #102 (comment) will break when uglifying. Here is a minification-safe version:
|
@janpapenbrock you're right, I copied from one of our projects where we use ng-annotate to automatically deal with the problem. |
There are many scenarios where you want to destroy the message/messages from the Controller for example on state change with ui-router, the message is still there. Or destroy the error message ones the form is valid again.
I think you should add to the docs that you can remove messages from the Controller like this for example:
var formErrorMessage = growl.error('You have an error in your form.'); //Instant show just example
var destroyErrorMessage = function() {
formErrorMessage.destroy();
};
//Call destroyErrorMessage() after validation success, next state or where ever.
Note! above is just example to show and destroy, so this will open the error message instantly.
The text was updated successfully, but these errors were encountered: