Close "select" html when my app resume from background

Hi, I have a “view/state” with a form HTML and in this form there is a <select> input type. When I click on this “input type”, iOS/Android show me the select options. And it is ok. Now with select options open it’s possible that my app goes in background for various reasons (incoming call or I that press the home button or other similar things).

When my app resumes itself from background this “select” is again open, but I don’t want it. I want it close!.

How can I do this ?

Thanks.

M.

You can detect the background / foreground events with this code in your run():

       //handle Cordova resume (enter foreground) and pause (enter background events)
        $ionicPlatform.on('resume', function() {
            $rootScope.$broadcast('onResume');
        });

        $ionicPlatform.on('pause', function() {
            $rootScope.$broadcast('onPause');
        });

…then in the controller where your select is:

//app entered foreground
$scope.$on('onResume', function () {
    //code here to close select

});

//app entered background
$scope.$on('onPause', function () {
    
});