This is a migrated thread and some comments may be shown as answers.

Accessing another viewmodel members

1 Answer 53 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Olafur
Top achievements
Rank 1
Olafur asked on 18 Aug 2013, 03:15 PM
I'm new to the MVVM and pure javascript applications and I have a question.

Is it possible to gain hold and access members or methods in another viewmodel to initialize it in a certain way before showing, like for example in a logout link I would like to clear the username and password etc. before showing the login view again?

Thanks,

*******

Sorry, this turned out to be simple

access a property:
app.loginService.viewModel.set("username","");

access a method:
app.loginService.viewModel.onLogout();

1 Answer, 1 is accepted

Sort by
0
Olafur
Top achievements
Rank 1
answered on 18 Aug 2013, 08:06 PM
Sorry, this turned out to be simple

app.loginService.viewModel.set("username","");
app.loginService.viewModel.onLogout();


Tags
General Discussions
Asked by
Olafur
Top achievements
Rank 1
Answers by
Olafur
Top achievements
Rank 1
Share this question
or