# Modal can not close on Android 4.2

**URL:** <https://forum.ionicframework.com/t/modal-can-not-close-on-android-4-2/870>\
**Category:** ionic-v1\
**Created:** [February 5, 2014, 9:35pm UTC](https://forum.ionicframework.com/t/modal-can-not-close-on-android-4-2/870 "2014-02-05T21:35:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nextmobi](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nextmobi](https://forum.ionicframework.com/u/nextmobi)\
**Post date:** [February 5, 2014, 9:35pm UTC](https://forum.ionicframework.com/t/modal-can-not-close-on-android-4-2/870/1 "2014-02-05T21:35:41Z")

</div>

Hi guys,

I am building Ionic with cordova, my app use Modal controller.  
Open modal is good but can’t close it. I tried mobile web (chrome android) and ios, blackberry apps is working.  
Only problem on Android 4.2  
Please help! Thank you so much

---

<div class="post-metadata">

**Author:** ![tim](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/tim/32/7550_2.png) [@tim](https://forum.ionicframework.com/u/tim)\
**Post date:** [February 5, 2014, 9:48pm UTC](https://forum.ionicframework.com/t/modal-can-not-close-on-android-4-2/870/2 "2014-02-05T21:48:22Z")

</div>

Hey can you post your code in either a codepen or a plunkr so we can take a look?

---

<div class="post-metadata">

**Author:** ![nextmobi](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nextmobi](https://forum.ionicframework.com/u/nextmobi)\
**Post date:** [February 6, 2014, 9:47am UTC](https://forum.ionicframework.com/t/modal-can-not-close-on-android-4-2/870/4 "2014-02-06T09:47:43Z")

</div>

Hi Time,

my code:

Controller:

// Load the modal from the given template URL  
$ionicModal.fromTemplateUrl(‘modal.html’, function (modal) { $scope.modal = modal; }, {  
// Use our scope for the scope of the modal to keep it simple  
scope: $scope,  
// The animation we want to use for the modal entrance  
animation: ‘slide-in-up’  
});

```
    $scope.openModal = function () {
        $scope.modal.show();

    };
    $scope.closeModal = function () {
        $scope.modal.hide();
    };

```

View:  
 ![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/104/a241d680a95e229e.jpg)

---

<div class="post-metadata">

**Author:** ![nextmobi](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nextmobi](https://forum.ionicframework.com/u/nextmobi)\
**Post date:** [February 11, 2014, 3:12am UTC](https://forum.ionicframework.com/t/modal-can-not-close-on-android-4-2/870/5 "2014-02-11T03:12:42Z")

</div>

Hi Tim,

I tried download and install Ionic Todo from Google Play, and Modal working on my android 4.2

Have problem with my code structure?

---

<div class="post-metadata">

**Author:** ![pix\_sawasdee](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pix\_sawasdee](https://forum.ionicframework.com/u/pix_sawasdee)\
**Post date:** [February 11, 2014, 1:15pm UTC](https://forum.ionicframework.com/t/modal-can-not-close-on-android-4-2/870/6 "2014-02-11T13:15:33Z")

</div>

I have the same problem.  
This is a temporary solution.

open ionic-angular.js go to line 387 and type

// Show the modal  
show: function() {  
var \_this = this;  
var element = angular.element(this.el);

```
  element.css('display', 'block'); //<--- Add this line

```

…  
…

go to line 417

// Hide the modal  
hide: function () {  
var element = angular.element(this.el);  
$animate.removeClass(element, this.animation);  
ionic.views.Modal.prototype.hide.call(this);

```
  element.css('display', 'none'); //<-- Add this line
},

```

…  
…

But doing this will make the animation doesn’t work when you close the modal.

---

<div class="post-metadata">

**Author:** ![nextmobi](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nextmobi](https://forum.ionicframework.com/u/nextmobi)\
**Post date:** [February 15, 2014, 1:14pm UTC](https://forum.ionicframework.com/t/modal-can-not-close-on-android-4-2/870/7 "2014-02-15T13:14:33Z")

</div>

Thanks @pix_sawasdee I will try…
