I've read virtually every stackoverflow question on this and still can't get it working...
I have a modal that I use as a "please wait" whilst async functions are occurring.
Viewmodel is:
define(['plugins/dialog', 'knockout'], function (dialog, ko) {
var CustomModal = function () {
var self = this;
this.msg = ko.observable(" Please Wait...");
};
CustomModal.show = function () {
return dialog.show(new CustomModal());
};
CustomModal.close = function () {
var self = this;
dialog.close(self);
};
return CustomModal;
});
I have other modals that have an "ok" button and they close just fine, but this one is opened (and I hoped, closed) from within my main logic flow.
I "require" the modal viewmodel in my main code and this works fine to show it:
modalBusy.show();
However, this does not ever close the dialog and it's driving me nuts!
modalBusy.close();
I get no errors when debugging, but "self" in my close method is not an actual viewmodel object, just contains the
var CustomModal = function () {
var self = this;
this.msg = ko.observable(" Please Wait...");
};
bit again and obviously that's wrong.