2

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.

Jonatas Walker
  • 13,583
  • 5
  • 53
  • 82
Jeff Riegel
  • 83
  • 2
  • 7

1 Answers1

1

Try this:

$scope.showModal = function() {
    myModal.$promise.then(myModal.show).then(function(){
        console.info('shown');
    });
};
Jonatas Walker
  • 13,583
  • 5
  • 53
  • 82
  • That works. My issue now which I didn't foresee is that the content of the modal is an Iframe and is not immediately available when the event fires. I have some ideas on that. Thanks much for your help! – Jeff Riegel Jun 19 '15 at 11:25
  • In case anyone is interested I used this post to wire up the iframe onload event http://stackoverflow.com/questions/15882326/angular-onload-function-on-an-iframe: window.uploadDone=function(){ /* have access to $scope here*/ } – Jeff Riegel Jun 19 '15 at 11:32