UNPKG

angular-ui-notification

Version:

Angular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animating

56 lines (48 loc) 1.81 kB
<html ng-app="notificationTest"> <head> <title>Notification demo</title> <link rel="stylesheet" type="text/css" href="bootstrap.min.css"> <link rel="stylesheet" href="angular-csp.css"> <link rel="stylesheet" href="angular-ui-notification.min.css"> </head> <body> <div class="container"> <h1>Angular ui-notification demo</h1> </div> <div ng-controller="notificationController"> <div class="container"> <h3>Types of notifications</h3> <div class="btn-group-vertical"> <button class="btn btn-primary" ng-click="primary()">Show notification</button> <button class="btn btn-danger" ng-click="danger()">Show unclosable notification</button> </div> </div> <div id="is-closed">{{hasElementClosed}}</div> </div> <script src="angular.min.js"></script> <script src="angular-ui-notification.min.js"></script> <script type="text/javascript"> angular.module('notificationTest', ['ui-notification']); angular.module('notificationTest') .controller('notificationController', function($scope, Notification) { $scope.hasElementClosed = false; $scope.primary = function() { Notification.primary({ message: "Just message", delay: 5000, onClose: function(element) { $scope.hasElementClosed = true; } }); }; $scope.danger = function() { Notification.error({ message: "Message won't close", delay: 5000, closeOnClick: false }); }; }); </script> </body> </html>