@@ -9,21 +9,24 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
9
9
} ,
10
10
// Show the modal
11
11
show : function ( ) {
12
- var _this = this ;
12
+ var self = this ;
13
13
var element = angular . element ( this . el ) ;
14
+
15
+ self . _isShown = true ;
16
+
14
17
if ( ! element . parent ( ) . length ) {
15
18
element . addClass ( this . animation ) ;
16
19
$animate . enter ( element , angular . element ( $document [ 0 ] . body ) , null , function ( ) {
17
20
} ) ;
18
- ionic . views . Modal . prototype . show . call ( _this ) ;
21
+ ionic . views . Modal . prototype . show . call ( self ) ;
19
22
} else {
20
23
$animate . addClass ( element , this . animation , function ( ) {
21
24
} ) ;
22
25
}
23
26
24
27
if ( ! this . didInitEvents ) {
25
28
var onHardwareBackButton = function ( ) {
26
- _this . hide ( ) ;
29
+ self . hide ( ) ;
27
30
} ;
28
31
29
32
self . scope . $on ( '$destroy' , function ( ) {
@@ -41,6 +44,7 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
41
44
} ,
42
45
// Hide the modal
43
46
hide : function ( ) {
47
+ this . _isShown = false ;
44
48
var element = angular . element ( this . el ) ;
45
49
$animate . removeClass ( element , this . animation ) ;
46
50
@@ -53,10 +57,15 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
53
57
remove : function ( ) {
54
58
var self = this ,
55
59
element = angular . element ( this . el ) ;
60
+ this . _isShown = false ;
56
61
$animate . leave ( angular . element ( this . el ) , function ( ) {
57
62
self . scope . $parent . $broadcast ( 'modal.removed' , self ) ;
58
63
self . scope . $destroy ( ) ;
59
64
} ) ;
65
+ } ,
66
+
67
+ isShown : function ( ) {
68
+ return ! ! this . _isShown ;
60
69
}
61
70
} ) ;
62
71
0 commit comments