1
1
angular . module ( 'ionic' )
2
2
3
3
/**
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
+ * ```
5
36
*/
6
37
. factory ( '$ionicBackdrop' , [
7
38
'$document' ,
@@ -13,7 +44,18 @@ function($document) {
13
44
$document [ 0 ] . body . appendChild ( el [ 0 ] ) ;
14
45
15
46
return {
47
+ /**
48
+ * @ngdoc method
49
+ * @name $ionicBackdrop#retain
50
+ * @description Retains the backdrop.
51
+ */
16
52
retain : retain ,
53
+ /**
54
+ * @ngdoc method
55
+ * @name $ionicBackdrop#retain
56
+ * @description
57
+ * Releases the backdrop.
58
+ */
17
59
release : release ,
18
60
// exposed for testing
19
61
_element : el
0 commit comments