Passing a promise to a callback
<p>I'm trying to write a javascript function that will show a bootstrap modal dialog and create a callback that will be executed when the dialog is close.  This is all within a Knockout view model, but not sure that's important.</p>

<pre><code>self.showModalDialog = function(optionData){
    var deferred = new $.Deferred();
    self.modalDlgViewModel.data = optionData;
    $('#myDialog').on('hidden.bs.modal',
        function (deferred) {
            deferred.resolve(self.modalDlgViewModel.status);
        });
    self.showDialog(true);
    return deferred;
}
</code></pre>

<p>This seems like it should work, but it when its gets to the the line of code inside the call back, deferred.resolve is no longer defined. What's going on with my promise?</p>

<p>Thanks</p>