问题
So when the first modal (this.$avatarModal) is closed, I would like a second modal (this.$modaldata) to open.:
The following sequence works however there are issues with the scrolling of the second modal not functioning:
this.$avatarModal.modal('hide');
this.$modaldata.modal('show');
As a solution to the scrolling issue, the dev on github are recommending to bind the event. However the following code, using .on does not work (the second modal does not open.
this.$avatarModal.modal('hide');
this.$avatarModal.on('hidden.bs.modal', function () {
this.$modaldata.modal('show');
});
However, If i replace the show event with an alert, the alert opens:
this.$avatarModal.modal("hide");
this.$avatarModal.on('hidden.bs.modal', function () {
window.alert('hidden event fired!');
});
This tells me that all the commands here are working, however having the 'show' method within the .on('hidden'... event does not seem to work.
Is there a reason for this incompatibility and how I can correctly open up the second modal after the first modal closes?
来源:https://stackoverflow.com/questions/27807225/bind-the-closing-of-a-first-modal-to-the-opening-of-a-second-modal