Overview
Ember Flash Message is a simple plugin that allows users to display a message on the next route transition in a similar way to Rails' flash[:notice]. This plugin is useful for displaying one-time notices on later pages.
Features
- Route Access: Any route in Ember.js can have access to the flashMessage('message') function, which sets the message to be displayed.
- Template Integration: The message can be displayed in any template by including the required code snippet. It is recommended to add this code to the application template for the message to be available on all pages.
- Instant Message: In some cases, users may want to display the message immediately without waiting for the route transition. This can be achieved using the now() function to update the message.
- Message Dismissal: The main FlashMessageController contains a convenience action called dismissFlashMessage, which removes the current message. Users can simply add a link or any other element to trigger this action.
- Controller Interaction: The flash message can be set from the controller by adding a needs dependency for the flashMessage controller. Whenever the flash message is set from a controller, it will be displayed instantly.
Summary
Ember Flash Message is a plugin that provides a simple way to display one-time notices on later pages in an Ember.js application. It allows users to set and display messages in various routes, with the option to show them instantly or after the next route transition. The plugin also supports message dismissal and integration with controllers. The installation process requires including the plugin file, adding code snippets to templates, and calling the required functions in routes or controllers.