Angular.js Flash Messages
npm install angular-flashFlash messages for Angular.js. Demo
Supports view changes, which means you can set a flash message, navigate to another view and your message will be displayed.
bower install angular-flash-messagesangular-flash.js to your project, add flash as a dependency to your module. Here is a simple example:``javascript`
angular.module('myModule', ['flash'])
.controller('EditProductController', function($scope, flash) {
$scope.save = function() {
// … save the product
flash('Saved!');
};
});
Then, in your HTML, simply add the element where you want your messages to be displayed. It can be in your main template or individual partials.
`html
Home
`
.Examples
-
flash('My message')`html
- My message
` -
flash([ 'Hi!', 'My message' ])`html
- Hi
- My message
` -
flash('error', 'Something went wrong…')`html
- Something went wrong…
` -
flash([ 'Hi!', { level: 'warning', text: 'This is a warning!' } ])`html
- Hi
- This is a warning!
``