Skip to content

spectra-music/angular-flash-pure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

angular-flash-pure

A simple flash notification module made up of a factory and a directive that will display flash messages using AngularJS. The directive uses pure-extras for styling of the alerts.

Installation

Download angular-flash-pure.min.js and pure-extras.css or install it with bower.

$ bower install angular-flash-pure --save

Usage

Load the module into your app

var myApp = angular.module('myApp', ['angular-flash-pure']);

Use the flash factory to set flash messages

myApp.controller('myController', ['flash', '$location', function(flash, $location){
  flash.notice.setMessage("I'm a flash notification!"); // error, success, and warning also work
  $location.path('/some/path');
}]);

Then in one of your views

<flash-messages></flash-messages>

And then it all works!

Manually triggering flash notifications

So the display of flash notifications are triggered by $locationChangeStart. But I'm aware that isn't always what you want. So if you would like the notification to appear without changing location, do the following when you want them to be displayed:

$rootScope.$emit("event:angularFlash");

Demo

Check out the Plunker. This demo uses the manual triggering of flash events.

Contributing

For this project, we use Bower, Grunt, and Coffeescript.

Build

$ grunt build