@@ -26,7 +26,7 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
26
26
_this . hide ( ) ;
27
27
} ;
28
28
29
- _this . scope . $on ( '$destroy' , function ( ) {
29
+ self . scope . $on ( '$destroy' , function ( ) {
30
30
$ionicPlatform . offHardwareBackButton ( onHardwareBackButton ) ;
31
31
} ) ;
32
32
@@ -36,20 +36,25 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
36
36
this . didInitEvents = true ;
37
37
}
38
38
39
+ this . scope . $parent . $broadcast ( 'modal.shown' , this ) ;
40
+
39
41
} ,
40
42
// Hide the modal
41
43
hide : function ( ) {
42
44
var element = angular . element ( this . el ) ;
43
45
$animate . removeClass ( element , this . animation ) ;
44
46
45
47
ionic . views . Modal . prototype . hide . call ( this ) ;
48
+
49
+ this . scope . $parent . $broadcast ( 'modal.hidden' , this ) ;
46
50
} ,
47
51
48
52
// Remove and destroy the modal scope
49
53
remove : function ( ) {
50
54
var self = this ,
51
55
element = angular . element ( this . el ) ;
52
56
$animate . leave ( angular . element ( this . el ) , function ( ) {
57
+ self . scope . $parent . $broadcast ( 'modal.removed' , self ) ;
53
58
self . scope . $destroy ( ) ;
54
59
} ) ;
55
60
}
@@ -80,7 +85,7 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
80
85
/**
81
86
* Load a modal with the given template string.
82
87
*
83
- * A new isolated scope will be created for the
88
+ * A new isolated scope will be created for the
84
89
* modal and the new element will be appended into the body.
85
90
*/
86
91
fromTemplate : function ( templateString , options ) {
0 commit comments