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

Showing flash only on next page #31

Closed
mren opened this issue May 6, 2014 · 2 comments
Closed

Showing flash only on next page #31

mren opened this issue May 6, 2014 · 2 comments

Comments

@mren
Copy link

mren commented May 6, 2014

How do I handle the case if there is a flash directive on the from page and on the page the form redirects to. I don't get the correct behaviour. Perhaps you can help me understand it.

My use case is the following. In my success callback I do the following

function success() {
    flash.success = 'Success';
    $location.path('/new-path');
}

Then the flash on my current page is notified, but because of the redirect, the $destroy event is called and the flash message is cleared. Thus the flash on the target page is empty.
The other variant I tried is to have the flash directive in the $rootScope, in this case the $destroy event is never called, but the flash is also not cleared while moving between pages.

I would like to use flash.success and flash.error and display the flash on the next (target) page, but only on this page and not the following pages. How can I do that?

@mren
Copy link
Author

mren commented May 7, 2014

Should this directive work with flashes that are displayed on a different route? The more I think about it, the more it seems, that this directive is only for flashes that should be shown on the very same page.
Is this correct or am I missing something here?

Best, Mark

@wmluke
Copy link
Owner

wmluke commented May 10, 2014

Hi @mren,

I feel your pain. See my comments in #28 (comment).

Thanks again,
Luke

@wmluke wmluke closed this as completed May 10, 2014
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

2 participants