Version: v0.8.1 - Beta.  We welcome contributors & feedback.

Session.setFlash

Session.set($key, $value) -> null

Description

Set a one-time session value for the given $key.

This value will only persist in the session until the following request.

Flash values are often used for success and error messages after the user submits an action.

// ... process user action ...

Session.setFlash('message', 'Congratulations!')


// ... in the NEXT request only ...

// In HTML template
--- if Session.hasFlash('message') {
    <div>{{ Session.getFlash('message') }}</div>
--- }

//= <div>Congratulations!</div>