I have the following in my viewmodel:
dialog.getContext().reposition(vm);
But it's not working, because I'm supposed to be passing the view
, not the viewmodel
. How can I - from within a viewmodel - get access to its corresponding view?
I have the following in my viewmodel:
dialog.getContext().reposition(vm);
But it's not working, because I'm supposed to be passing the view
, not the viewmodel
. How can I - from within a viewmodel - get access to its corresponding view?
To Access the view from your viewModel You have detached
,compositionComplete
, attached
, and compositionComplete
handlers to choose from.
For example from attached
:
function attached(view, parent) {
console.log("This is the current view",view);//this will log the view HTML
$(view).find(".smallLoader").fadeOut();// Now fadeOut .smallLoader from this view
}
var viewModel = {
activate: activate,
title: 'Home',
attached: attached
};
return viewModel;