You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+59-4Lines changed: 59 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,13 @@
1
1
angular-block-ui
2
2
============
3
-
A simple AngularJS module that allows you to block user interaction on AJAX requests. Blocking is done automatically for each http request and/or manually via an injectable service.
3
+
An elegant but advanced AngularJS module that allows you to block user interaction on AJAX requests. Blocking is done automatically for each http request and/or manually via an injectable service.
4
4
5
5
#### Dependencies
6
6
Besides AngularJS (~1.2.4), none.
7
7
8
+
#### Demos
9
+
Live demos can be found on [Plunker](http://run.plnkr.co/tI1k1V4E2zd188Oi/) or by executing the website included in the [GitHub project](https://github.com/McNull/angular-block-ui) .
10
+
8
11
#### Installation
9
12
Either copy the contents of the `package` directory of the [Github](https://github.com/McNull/angular-block-ui) project or install with _bower_ from the command line (**recommended**):
10
13
@@ -14,8 +17,7 @@ Include both the JS and CSS file in your html:
Create a dependency on `blockUI` in your main Angular module:
20
22
21
23
angular.module('myApp', ['blockUI'])
@@ -59,7 +61,7 @@ Indicates the message to be shown in the overlay. If none is provided, the defau
59
61
This will decrease the block count. The block will end if the count is 0.
60
62
61
63
#### reset
62
-
The reset will force a unblock by setting the block count to 0.
64
+
The reset will force an unblock by setting the block count to 0.
63
65
64
66
#### message
65
67
Allows the message shown in the overlay to be updated while to block is active.
@@ -72,6 +74,59 @@ Queues a callback function to be called when the block has finished. This can be
72
74
***callback** (function)
73
75
The callback function to queue.
74
76
77
+
Blocking individual elements
78
+
============================
79
+
80
+
Instead of blocking the whole page, it's also possible to block individual elements. Just like the main `blockUI` service, this can be done either manually or automatically. Elements can be made _block ui enabled_ by adding a sibling `block-ui` directive element.
81
+
82
+
```
83
+
<div>
84
+
<p> ... I'm blockable ... </p>
85
+
<div block-ui="myBlockUI"></div>
86
+
</div>
87
+
```
88
+
89
+
#### Automatic blocking
90
+
91
+
Automatic blocking elements can be done by providing the `block-ui` directive a `block-ui-pattern` attribute. This attribute should contain a valid regular expression, which indicates the requests that are associated with the specific element.
92
+
93
+
```
94
+
<div>
95
+
<p> ... I'm blockable ... </p>
96
+
<!-- Initiated the block whenever a request to '/api/quote' is performed -->
By providing the `block-ui` directive a name the controller can request the instance via the injected `blockUI` service. All functions exposed by the main `blockUI` service are available on the individual instances.
0 commit comments