Search code examples
javascriptmodal-dialogangular-strap

How to wireup an AngularStrap modal show event


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.


Solution

  • Try this:

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