@@ -310,7 +310,7 @@ angular.module('ionic.service.loading', ['ionic.ui.loading'])
310
310
angular . module ( 'ionic.service.modal' , [ 'ionic.service.templateLoad' , 'ionic.service.platform' , 'ngAnimate' ] )
311
311
312
312
313
- . factory ( '$ionicModal' , [ '$rootScope' , '$document' , '$compile' , '$animate' , '$q' , '$ionicPlatform' , '$ionicTemplateLoader' , function ( $rootScope , $document , $compile , $animate , $q , $ionicPlatform , $ionicTemplateLoader ) {
313
+ . factory ( '$ionicModal' , [ '$rootScope' , '$document' , '$compile' , '$animate' , '$q' , '$timeout' , '$ ionicPlatform', '$ionicTemplateLoader' , function ( $rootScope , $document , $compile , $animate , $q , $timeout , $ionicPlatform , $ionicTemplateLoader ) {
314
314
var ModalView = ionic . views . Modal . inherit ( {
315
315
initialize : function ( opts ) {
316
316
ionic . views . Modal . prototype . initialize . call ( this , opts ) ;
@@ -330,16 +330,20 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
330
330
} ) ;
331
331
}
332
332
333
- var onHardwareBackButton = function ( ) {
334
- _this . hide ( ) ;
335
- } ;
333
+ if ( ! this . didInitEvents ) {
334
+ var onHardwareBackButton = function ( ) {
335
+ _this . hide ( ) ;
336
+ } ;
336
337
337
- _this . scope . $on ( '$destroy' , function ( ) {
338
- $ionicPlatform . offHardwareBackButton ( onHardwareBackButton ) ;
339
- } ) ;
338
+ _this . scope . $on ( '$destroy' , function ( ) {
339
+ $ionicPlatform . offHardwareBackButton ( onHardwareBackButton ) ;
340
+ } ) ;
340
341
341
- // Support Android back button to close
342
- $ionicPlatform . onHardwareBackButton ( onHardwareBackButton ) ;
342
+ // Support Android back button to close
343
+ $ionicPlatform . onHardwareBackButton ( onHardwareBackButton ) ;
344
+
345
+ this . didInitEvents = true ;
346
+ }
343
347
344
348
} ,
345
349
// Hide the modal
@@ -1233,12 +1237,7 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
1233
1237
if ( attr . hasSubheader == "true" ) { element . addClass ( 'has-subheader' ) ; }
1234
1238
if ( attr . hasFooter == "true" ) { element . addClass ( 'has-footer' ) ; }
1235
1239
if ( attr . hasTabs == "true" ) { element . addClass ( 'has-tabs' ) ; }
1236
- if ( attr . padding == "true" ) {
1237
- var scroll = element . find ( '.scroll' ) ;
1238
- if ( scroll . length ) {
1239
- scroll . addClass ( 'padding' ) ;
1240
- }
1241
- }
1240
+ if ( attr . padding == "true" ) { element . find ( '.scroll' ) . addClass ( 'padding' ) ; }
1242
1241
1243
1242
return function link ( $scope , $element , $attr ) {
1244
1243
var clone , sc , sv ,
0 commit comments