Modal can not close on Android 4.2

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

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

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:

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?

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.

1 Like

Thanks @pix_sawasdee I will try…