{"action":"created","issue":{"url":"https://api.github.com/repos/JanStevens/angular-growl-2/issues/102","labels_url":"https://api.github.com/repos/JanStevens/angular-growl-2/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/JanStevens/angular-growl-2/issues/102/comments","events_url":"https://api.github.com/repos/JanStevens/angular-growl-2/issues/102/events","html_url":"https://github.com/JanStevens/angular-growl-2/issues/102","id":101028925,"number":102,"title":"Removing messsage from Controller","user":{"login":"eduardoinnorway","id":8614790,"avatar_url":"https://avatars.githubusercontent.com/u/8614790?v=3","gravatar_id":"","url":"https://api.github.com/users/eduardoinnorway","html_url":"https://github.com/eduardoinnorway","followers_url":"https://api.github.com/users/eduardoinnorway/followers","following_url":"https://api.github.com/users/eduardoinnorway/following{/other_user}","gists_url":"https://api.github.com/users/eduardoinnorway/gists{/gist_id}","starred_url":"https://api.github.com/users/eduardoinnorway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eduardoinnorway/subscriptions","organizations_url":"https://api.github.com/users/eduardoinnorway/orgs","repos_url":"https://api.github.com/users/eduardoinnorway/repos","events_url":"https://api.github.com/users/eduardoinnorway/events{/privacy}","received_events_url":"https://api.github.com/users/eduardoinnorway/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-14T14:59:26Z","updated_at":"2015-09-28T12:04:09Z","closed_at":null,"body":"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.\r\n\r\nI think you should add to the docs that you can remove messages from the Controller like this for example:\r\n\r\n---\r\nvar formErrorMessage = growl.error('You have an error in your form.'); //Instant show just example\r\n\r\nvar destroyErrorMessage = function() {\r\n        formErrorMessage.destroy();\r\n};\r\n\r\n//Call destroyErrorMessage() after validation success, next state or where ever.\r\n----\r\nNote! above is just example to show and destroy, so this will open the error message instantly.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JanStevens/angular-growl-2/issues/comments/143724500","html_url":"https://github.com/JanStevens/angular-growl-2/issues/102#issuecomment-143724500","issue_url":"https://api.github.com/repos/JanStevens/angular-growl-2/issues/102","id":143724500,"user":{"login":"fabiosussetto","id":103664,"avatar_url":"https://avatars.githubusercontent.com/u/103664?v=3","gravatar_id":"","url":"https://api.github.com/users/fabiosussetto","html_url":"https://github.com/fabiosussetto","followers_url":"https://api.github.com/users/fabiosussetto/followers","following_url":"https://api.github.com/users/fabiosussetto/following{/other_user}","gists_url":"https://api.github.com/users/fabiosussetto/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiosussetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiosussetto/subscriptions","organizations_url":"https://api.github.com/users/fabiosussetto/orgs","repos_url":"https://api.github.com/users/fabiosussetto/repos","events_url":"https://api.github.com/users/fabiosussetto/events{/privacy}","received_events_url":"https://api.github.com/users/fabiosussetto/received_events","type":"User","site_admin":false},"created_at":"2015-09-28T12:04:09Z","updated_at":"2015-09-28T12:04:09Z","body":"With the latest version (0.7.5), you can do it by using the growlMessages service like this:\r\n```\r\n.run(function ($rootScope, growlMessages) {\r\n        $rootScope.$on('$stateChangeSuccess', () => {\r\n            growlMessages.destroyAllMessages();\r\n        });\r\n    });\r\n```\r\n\r\nNote that on 0.7.3 there was an issue with the way destroyAllMessages looped over the messages internally, so that wouldn't work."}}