Amogh Talpallikar
Amogh Talpallikar

Reputation: 12184

How to hide a ionic modal that shows a list after selecting a value?

I have a ion-view that shows a list of items in a modal. I want to dismiss the modal once I select an item. I have associated the modal template with a controller using an ng-controller attribute.

How do I dismiss the modal form inside the controller where I will be getting click events ?

Upvotes: 0

Views: 1336

Answers (2)

Mandeep Singh
Mandeep Singh

Reputation: 905

If you are using multiple modals, give different names to scope variables..

$ionicModal.
    fromTemplateUrl('example.html', {
        scope: $scope,
        animation: 'slide-in-up'  }).
    then(function(modal) {
        $scope.exmapleModal = modal;
        $scope.exmapleModal.show();
        $scope.closeExample = function() {
            $scope.exmapleModal.hide();
            $scope.exmapleModal.remove();
        };
    });

Close the modal the same name as $scope.closeExample();

Upvotes: 0

Anik Islam Abhi
Anik Islam Abhi

Reputation: 25352

try like this

$scope.modal.hide();

Upvotes: 2

Related Questions