Skip to content

Commit 730a33b

Browse files
committed
feat($ionicBackdrop): add backdrop show/hide service
Closes #1084
1 parent bc3e223 commit 730a33b

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

Diff for: docs/templates/api_menu_version.template.html

+13-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,19 @@
399399
</ul>
400400
</li>
401401

402-
402+
<!-- Backdrop -->
403+
<li class="menu-section">
404+
<a href="#" class="api-section">
405+
Backdrop
406+
</a>
407+
<ul>
408+
<li>
409+
<a href="{{ page.versionHref }}/api/service/$ionicBackdrop">
410+
$ionicBackdrop
411+
</a>
412+
</li>
413+
</ul>
414+
</li>
403415

404416
<!-- Utility -->
405417
<li class="menu-section">

Diff for: js/ext/angular/src/service/ionicBackdrop.js

+43-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
11
angular.module('ionic')
22

33
/**
4-
* @private
4+
* @ngdoc service
5+
* @name $ionicBackdrop
6+
* @module ionic
7+
* @description
8+
* Shows and hides a backdrop over the UI. Appears behind popups, loading,
9+
* and other overlays.
10+
*
11+
* Often, multiple UI components require a backdrop, but only one backdrop is
12+
* ever needed in the DOM at a time.
13+
*
14+
* Therefore, each component that requires the backdrop to be shown calls
15+
* `$ionicBackdrop.retain()` when it wants the backdrop, then `$ionicBackdrop.release()`
16+
* when it is done with the backdrop.
17+
*
18+
* For each time `retain` is called, the backdrop will be shown until `release` is called.
19+
*
20+
* For example, if `retain` is called three times, the backdrop will be shown until `release`
21+
* is called three times.
22+
*
23+
* @usage
24+
*
25+
* ```js
26+
* function MyController($scope, $ionicBackdrop, $timeout) {
27+
* //Show a backdrop for one second
28+
* $scope.action = function() {
29+
* $ionicBackdrop.retain();
30+
* $timeout(function() {
31+
* $ionicBackdrop.release();
32+
* }, 1000);
33+
* };
34+
* }
35+
* ```
536
*/
637
.factory('$ionicBackdrop', [
738
'$document',
@@ -13,7 +44,18 @@ function($document) {
1344
$document[0].body.appendChild(el[0]);
1445

1546
return {
47+
/**
48+
* @ngdoc method
49+
* @name $ionicBackdrop#retain
50+
* @description Retains the backdrop.
51+
*/
1652
retain: retain,
53+
/**
54+
* @ngdoc method
55+
* @name $ionicBackdrop#retain
56+
* @description
57+
* Releases the backdrop.
58+
*/
1759
release: release,
1860
// exposed for testing
1961
_element: el

0 commit comments

Comments
 (0)