Implemented URL query parsing for initial token /opa/?token=abcde
[src/app-framework-demo.git] / afb-client / bower_components / angular-ui-notification / README.md
1 angular-ui-notification
2 =======================
3
4 [![Dependency Status](https://david-dm.org/alexcrack/angular-ui-notification.png)](https://david-dm.org/alexcrack/angular-ui-notification)
5 [![devDependency Status](https://david-dm.org/alexcrack/angular-ui-notification/dev-status.png)](https://david-dm.org/alexcrack/angular-ui-notification#info=devDependencies)
6 [![Build Status](https://travis-ci.org/alexcrack/angular-ui-notification.svg?branch=master)](https://travis-ci.org/alexcrack/angular-ui-notification)
7 [![Dependency Status](https://www.versioneye.com/user/projects/54f96af44f3108e7800000e4/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54f96af44f3108e7800000e4)
8 [![Code Climate](https://codeclimate.com/github/alexcrack/angular-ui-notification/badges/gpa.svg)](https://codeclimate.com/github/alexcrack/angular-ui-notification)
9
10 Angular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animations
11
12 ## Features
13 * No dependencies except of angular.js.
14 * CSS3 Animations.
15 * Small size.
16 * 5 message types.
17 * Use HTML in your messages.
18 * Configure options globally py the provider
19 * Use custom options by the message
20 * Use custom template
21
22 ## Install
23
24 To install the package using bower and save as a dependency use...
25 ```bash
26 bower install angular-ui-notification --save
27 ```  
28
29 ## Usage
30  [Heres a plunker demo](http://plnkr.co/edit/5Gk8UVvzUsjyof7Gxsua?p=preview)
31
32   
33 In your html/template add 
34 ```html
35 ...
36   <link rel="stylesheet" href="angular-ui-notification.min.css">
37 ...
38   <script src="angular-ui-notification.min.js"></script>
39 ...
40
41 ```
42
43 In your application, declare dependency injection like so..
44
45 ```javascript
46   angular.module('notificationTest', ['ui-notification']);
47 ...
48 ```
49
50 You can configure module by the provider
51 ```javascript
52 angular.module('notificationTest', ['ui-notification'])
53     .config(function(NotificationProvider) {
54         NotificationProvider.setOptions({
55             delay: 10000,
56             startTop: 20,
57             startRight: 10,
58             verticalSpacing: 20,
59             horizontalSpacing: 20,
60             positionX: 'left',
61             positionY: 'bottom'
62         });
63     });
64 ...
65 ```
66
67
68 And when you need to show notifications, inject service and call it!
69
70 ```javascript
71 angular.module('notificationTest').controller('notificationController', function($scope, Notification) {
72  
73   Notification.primary('Primary notification');
74   // or simply..
75   Notification('Primary notification');
76   
77   // Other Options
78   // Success
79   Notification.success('Success notification');
80   
81   // With Title
82   Notification({message: 'Primary notification', title: 'Primary notification'});
83   
84   // Message with custom delay
85   Notification.error({message: 'Error notification 1s', delay: 1000});
86   
87   // Embed HTML within your message.....
88   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'});
89
90   // Change position notification
91   Notification.error({message: 'Error Bottom Right', positionY: 'bottom', positionX: 'right'});
92   
93   // Replace message
94   Notification.error({message: 'Error notification 1s', replaceMessage: true});
95 }
96 ```
97
98 ## Service
99
100 Module name: "ui-notification"
101
102 Service: "Notification"
103
104 Configuration provider: "NotificationProvider"
105
106
107 ## Options
108
109 Options can be passed to configuration provider globally or used in the current message.
110
111 The options list:
112
113 |       Option      |      Possible values      |         Default value          |                               Description                                |
114 | ----------------- | ------------------------- | ------------------------------ | ------------------------------------------------------------------------ |
115 | delay             | Any integer value         | 5000                           | The time in ms the message is showing before start fading out            |
116 | startTop          | Any integer value         | 10                             | Vertical padding between messages and vertical border of the browser     |
117 | startRight        | Any integer value         | 10                             | Horizontal padding between messages and horizontal border of the browser |
118 | verticalSpacing   | Any integer value         | 10                             | Vertical spacing between messages                                        |
119 | horizontalSpacing | Any integer value         | 10                             | Horizontal spacing between messages                                      |
120 | positionX         | "right", "left", "center" | "right"                        | Horizontal position of the message                                       |
121 | positionY         | "top", "bottom"           | "top"                          | Vertical position of the message                                         |
122 | replaceMessage    | true, false               | false                          | If true every next appearing message replace old messages                |
123 | templateUrl       | Any string                | "angular-ui-notification.html" | Custom template filename (URL)                                           |
124
125 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
126
127 ## Methods
128
129 #### Notification service methods
130
131 |              Method name               |                   Description                   |
132 |----------------------------------------|-------------------------------------------------|
133 | Notification(), Notification.primary() | Show the message with bootstrap's primary class |
134 | Notification.info()                    | Show the message with bootstrap's info class    |
135 | Notification.success()                 | Show the message with bootstrap's success class |
136 | Notification.warning()                 | Show the message with bootstrap's warn class    |
137 | Notification.error()                   | Show the message with bootstrap's danger class  |
138 | Notification.clearAll()                | Remove all shown messages                       |
139
140 #### Notification service options
141
142 |     Option     |                 Possible values                  |           Default value           |                                              Description                                               |
143 | -------------- | ------------------------------------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------ |
144 | title          | *String*                                         | `""`                              | Title to appear at the top of the notification                                                         |
145 | message        | *String*                                         | `""`                              | Message to appear in the notification                                                                  |
146 | templateUrl    | *String*                                         | `"angular-ui-notification.html"`  | URL of template to be used for notification                                                            |
147 | delay          | *Int* (?)                                        | `5000` or configured global delay | Number of ms before notification fades out. If not an integer, notification will persist until killed. |
148 | type           | "primary", "info", "success", "warning", "error" | `"primary"`                       | Bootstrap flavoring                                                                                    |
149 | positionY      | "top", "bottom"                                  | `"top"`                           |                                                                                                        |
150 | positionX      | "right", "left", "center"                        | `"right"                          |                                                                                                        |
151 | replaceMessage | *Boolean*                                        | `false`                           | If true this message will replace old(er) message(s)                                                   |
152
153 #### Returning value
154
155 Every "show" method returns a promise resolves a notification scope with methods:
156
157 |          Method name           |                                                   Description                                                    |
158 |--------------------------------|------------------------------------------------------------------------------------------------------------------|
159 | notificationScope.kill(isHard) | Remove the specific message<br>isHard - if false or omitted kill message with fadeout effect (default). If true - immediately remove the message|
160
161
162
163 ## Custom Templates
164
165 Custom template can be provided.
166
167 ```html
168 <div class="ui-notification">
169     <h3 ng-show="title" ng-bind-html="title"></h3>
170     <div class="message" ng-bind-html="message"></div>
171 </div>
172 ```
173 Default existing scope values is "title" - the title of the message and "message".
174 Also any custom scope's properties can be used.