Angular Foundation Toaster is a AngularJS port of the toastr non-blocking notification jQuery library using Foundation styles and Font-Awesome icons. It requires AngularJS v1.2.6 or higher, Zurb/Foundation and Font-Awesome.
-
An angular app
-
Zurb/Foundation
-
A build that recognizes bower components
- Install the module:
bower install praesidio/angular-foundation-toaster
-
Add toaster container directive:
<toaster-container></toaster-container>
-
Prepare the call of toaster method:
// Display an info toast with no title
angular.module('main', ['toaster'])
.controller('myController', function($scope, toaster) {
$scope.info = function(){
toaster.pop("title", "text");
};
});
// Display an alert toast with no title
angular.module('main', ['toaster'])
.controller('myController', function($scope, toaster) {
$scope.alert = function(){
toaster.pop("title", "text", {type: 'alert'});
};
});
- Call controller method on button click:
<div ng-controller="myController">
<button ng-click="info()">Show Info</button>
<button ng-click="alert()">Show Alert</button>
</div>
// Change display position
<toaster-container toaster-options="{'container-class': 'left'}"></toaster-container>
This library uses jqLite and CSS3 animations. So far only a 'leave' anination is supported, and can be specified by simply specifying your own @keyframes style animation class in the toaster-options as 'leave-class'.
Brandon Smith
Forked from AngularJS-Toaster by Jiri Kavulak which was inspired by http://codeseven.github.io/toastr/demo.html.
Copyright © 2014 Brandon Smith.
angular-foundation-toaster is under MIT license - http://www.opensource.org/licenses/mit-license.php