https://github.com/cottrellio/notifications
AngularJS Notification Service
https://github.com/cottrellio/notifications
Last synced: about 1 month ago
JSON representation
AngularJS Notification Service
- Host: GitHub
- URL: https://github.com/cottrellio/notifications
- Owner: cottrellio
- License: gpl-2.0
- Created: 2014-01-31T03:56:26.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-05-16T13:55:02.000Z (about 12 years ago)
- Last Synced: 2025-03-13T06:13:52.909Z (about 1 year ago)
- Language: JavaScript
- Size: 234 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Notifications (AngularJS Service)
=============
AngularJS Notification Service.
[Live Plnkr Demo](http://plnkr.co/edit/6N599Kz21gxyTkbwxdMl?p=preview)
Dependancies
====
* AngularJS v-1.2.*
* Uses Font Awesome icons (but you can make your own icon font at IcoMoon)
* The demo uses ngAnimate (optional)
Installation
====
1) Include the script, css, FontAwesome in the head.
2) Inject the notifications service into your ngApp. (along with other dependancies suchas ngAnimate)
angular.module('MyApp', ['notifications', 'ngAnimate']);
3) Pass the service into your controller as an argument. (must pass in $notification as well as $timeout)
function MainCtrl($scope, $notification, $timeout) {
4) place an element in your html where you want the notifications to populate and specify the corner you want them to be positioned in. (Choices: top, bottom, left, right)
5) Create a method within your controller to handle the notification creation! Here's an example:
$scope.newNote = function(type) {
var title = type.charAt(0).toUpperCase() + type.slice(1);
$notification.notify(type, '', '', title, title + ' message.');
};
6) Great, finally just add some html in your controller to invoke your newNote() method:
Success!
All done! Click the button and watch your notifications populate.