All Projects → alexcrack → Angular Ui Notification

alexcrack / Angular Ui Notification

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

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Angular Ui Notification

Wordpress Bootstrap
Bootstrap in WordPress theme form - Bootstrap 3.3.1
Stars: ✭ 1,494 (+172.13%)
Mutual labels:  bootstrap, bootstrap3
Yii2 Bootstrap
Yii 2 Bootstrap 3 Extension
Stars: ✭ 177 (-67.76%)
Mutual labels:  bootstrap, bootstrap3
Cakephp3 Bootstrap Helpers
CakePHP 3.x Helpers for Bootstrap 3 and 4.
Stars: ✭ 134 (-75.59%)
Mutual labels:  bootstrap, bootstrap3
Bootstrap 4 Utilities
Bootstrap 4 utility classes in LESS CSS for Bootstrap 3 or any other projects.
Stars: ✭ 105 (-80.87%)
Mutual labels:  bootstrap, bootstrap3
React Bs Notifier
A react component to show growl-like notifications using bootstrap alerts
Stars: ✭ 112 (-79.6%)
Mutual labels:  notifications, bootstrap
Vue Cli Multipage Bootstrap
vue-cli-multipage-bootstrap demo with vue2+vue-router+vuex+bootstrap+markdown for learning vue2.0
Stars: ✭ 105 (-80.87%)
Mutual labels:  bootstrap, bootstrap3
X Editable Rails
Edit fields easily with X-Editable helper
Stars: ✭ 159 (-71.04%)
Mutual labels:  bootstrap, bootstrap3
Bootstrap Ui
⚠️ IN MAINTENANCE MODE. Bootstrap UI is a Bootstrap extension for building beautiful web apps user interfaces.
Stars: ✭ 60 (-89.07%)
Mutual labels:  bootstrap, bootstrap3
Crypto Coin Alerts
An application that let you set alerts for the prices of several cryptocurrencies
Stars: ✭ 72 (-86.89%)
Mutual labels:  notifications, bootstrap
Notifo
Multi channel notification service for collaboration tools, e-commerce, news service and more.
Stars: ✭ 32 (-94.17%)
Mutual labels:  notifications, bootstrap
Aurelia Slickgrid
Aurelia-Slickgrid a wrapper of the lightning fast & customizable SlickGrid datagrid with a few Styling Themes
Stars: ✭ 100 (-81.79%)
Mutual labels:  bootstrap, bootstrap3
Ci Adminlte
CodeIgniter 3.1.10 with AdminLTE 2.3.11
Stars: ✭ 259 (-52.82%)
Mutual labels:  bootstrap, bootstrap3
Bootstrap Colorpicker
Bootstrap Colorpicker is a modular color picker plugin for Bootstrap.
Stars: ✭ 1,351 (+146.08%)
Mutual labels:  bootstrap, bootstrap3
Bootstrap Validate
A simple Form Validation Library for Bootstrap 3 and Bootstrap 4 not depending on jQuery.
Stars: ✭ 112 (-79.6%)
Mutual labels:  bootstrap, bootstrap3
Ladda Bootstrap
Ladda buttons concept originally by @hakimel, example using Bootstrap 3 by @msurguy
Stars: ✭ 1,258 (+129.14%)
Mutual labels:  bootstrap, bootstrap3
Bootstrap
基于bootstrap3搭建的页面结构
Stars: ✭ 137 (-75.05%)
Mutual labels:  bootstrap, bootstrap3
Uiv
Bootstrap 3 components implemented by Vue 2.
Stars: ✭ 882 (+60.66%)
Mutual labels:  bootstrap, bootstrap3
Bootstrap Blog Template
An awesome blog template constructed using Twitter Bootstrap 3
Stars: ✭ 29 (-94.72%)
Mutual labels:  bootstrap, bootstrap3
Jblog
🔱一个简洁漂亮的java blog 👉基于Spring /MVC+ Hibernate + MySQL + Bootstrap + freemarker. 实现 🌈
Stars: ✭ 187 (-65.94%)
Mutual labels:  bootstrap, bootstrap3
Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (-68.31%)
Mutual labels:  notifications, bootstrap

angular-ui-notification

Dependency Status devDependency Status Build Status Dependency Status Code Climate

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

Features

  • No dependencies except of angular.js.
  • CSS3 Animations.
  • Small size.
  • 5 message types.
  • Use HTML in your messages.
  • Configure options globally py the provider
  • Use custom options by the message
  • Use custom template

Install

To install the package using bower and save as a dependency use...

bower install angular-ui-notification --save

To install via NPM:

npm install angular-ui-notification --save

Usage

Heres a plunker demo

In your html/template add

...
  <link rel="stylesheet" href="angular-ui-notification.min.css">
...
  <script src="angular-ui-notification.min.js"></script>
...

In your application, declare dependency injection like so..

  angular.module('notificationTest', ['ui-notification']);
...

You can configure module by the provider

angular.module('notificationTest', ['ui-notification'])
    .config(function(NotificationProvider) {
        NotificationProvider.setOptions({
            delay: 10000,
            startTop: 20,
            startRight: 10,
            verticalSpacing: 20,
            horizontalSpacing: 20,
            positionX: 'left',
            positionY: 'bottom'
        });
    });
...

And when you need to show notifications, inject service and call it!

angular.module('notificationTest').controller('notificationController', function($scope, Notification) {
 
  Notification.primary('Primary notification');
  // or simply..
  Notification('Primary notification');
  
  // Other Options
  // Success
  Notification.success('Success notification');
  
  // Message with custom type
  Notification({message: 'Warning notification'}, 'warning');

  // With Title
  Notification({message: 'Primary notification', title: 'Primary notification'});
  
  // Message with custom delay
  Notification.error({message: 'Error notification 1s', delay: 1000});
  
  // Embed HTML within your message.....
  Notification.success({message: 'Success notification<br>Some other <b>content</b><br><a href="https://github.com/alexcrack/angular-ui-notification">This is a link</a><br><img src="https://angularjs.org/img/AngularJS-small.png">', title: 'Html content'});

  // Change position notification
  Notification.error({message: 'Error Bottom Right', positionY: 'bottom', positionX: 'right'});
  
  // Replace message
  Notification.error({message: 'Error notification 1s', replaceMessage: true});
}

Service

Module name: "ui-notification"

Service: "Notification"

Configuration provider: "NotificationProvider"

Options

Options can be passed to configuration provider globally or used in the current message.

The options list:

Option Possible values Default value Description
delay Any integer value 5000 The time in ms the message is showing before start fading out
startTop Any integer value 10 Vertical padding between messages and vertical border of the browser
startRight Any integer value 10 Horizontal padding between messages and horizontal border of the browser
verticalSpacing Any integer value 10 Vertical spacing between messages
horizontalSpacing Any integer value 10 Horizontal spacing between messages
positionX "right", "left", "center" "right" Horizontal position of the message
positionY "top", "bottom" "top" Vertical position of the message
replaceMessage true, false false If true every next appearing message replace old messages
templateUrl Any string "angular-ui-notification.html" Custom template filename (URL)
onClose Any function undefined Callback to execute when a notification element is closed. Callback receives the element as its argument.
closeOnClick true, false true If true, messages are closed on click
maxCount Any integer 0 Show only [maxCount] last messages. Old messages will be killed. 0 - do not kill
priority Any integer 10 The highier the priority is, the higher the notification will be

Also you can pass the "scope" option. This is an angular scope option Notification scope will be inherited from. This option can be passed only in the methods. The default value is $rootScope

Methods

Notification service methods

Method name Description
Notification(), Notification.primary() Show the message with bootstrap's primary class
Notification.info() Show the message with bootstrap's info class
Notification.success() Show the message with bootstrap's success class
Notification.warning() Show the message with bootstrap's warn class
Notification.error() Show the message with bootstrap's danger class
Notification.clearAll() Remove all shown messages

Notification service options

Option Possible values Default value Description
title String "" Title to appear at the top of the notification
message String "" Message to appear in the notification
templateUrl String "angular-ui-notification.html" URL of template to be used for notification
delay Int (?) 5000 or configured global delay Number of ms before notification fades out. If not an integer, notification will persist until killed.
type "primary", "info", "success", "warning", "error" "primary" Bootstrap flavoring
positionY "top", "bottom" "top"
positionX "right", "left", "center" `"right"
replaceMessage Boolean false If true this message will replace old(er) message(s)
closeOnClick true, false true If true, the message is closed on click

Returning value

Every "show" method returns a promise that resolves a notification scope with these methods:

Method name Description
notificationScope.kill(isHard) Remove the specific message
isHard - if false or omitted kill message with fadeout effect (default). If true - immediately remove the message

Custom Templates

Custom template can be provided.

<div class="ui-notification">
    <h3 ng-show="title" ng-bind-html="title"></h3>
    <div class="message" ng-bind-html="message"></div>
</div>

Default existing scope values is "title" - the title of the message and "message". Also any custom scope's properties can be used.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].