How to wireup an AngularStrap modal show event

645 Views Asked by At

I have the modal displaying just fine. I'm trying to figure out how to run a function when the modal is shown.

 var = loginModal = $modal({ placement: 'left', title: '', content: webauth, show: false });

 $scope.$on('modal.show', function () {
        console.log("SHOWN");
        debugger;
    });

    $scope.showModal = function () {

        loginModal.$promise
            .then(loginModal.show);

    };

I was expecting the $scope.$on('modal.show') to fire when the modal is shown, but no luck so far.

1

There are 1 best solutions below

2
On BEST ANSWER

Try this:

$scope.showModal = function() {
    myModal.$promise.then(myModal.show).then(function(){
        console.info('shown');
    });
};