Passing value from view-model page to code-behind page


#1

I am using the design pattern shown in the NS javascript groceries tutorial. In this file https://github.com/NativeScript/sample-Groceries/blob/end/app/shared/view-models/user-view-model.js you create the code that is called by https://github.com/NativeScript/sample-Groceries/blob/end/app/views/login/login.js.

In the https://github.com/NativeScript/sample-Groceries/blob/end/app/shared/view-models/user-view-model.js i notice that it return values but they are not available in https://github.com/NativeScript/sample-Groceries/blob/end/app/views/login/login.js at any time. I want to out put the actual reason for not logging in that comes from the server and not use a generic message as seen in that example. How do I do that?

for example line 29 on here https://github.com/NativeScript/sample-Groceries/blob/end/app/shared/view-models/user-view-model.js does a return but it is not available in line 29 here https://github.com/NativeScript/sample-Groceries/blob/end/app/views/login/login.js. Kinda seem similar to issues in jquery returning data in a asynchronous call?