Update Home ViewModel property form SideDrawer


I’m new to NativeScritp, I have property in my home-view-model.js

var observableModule = require("data/observable");

function HomeViewModel() {
    var viewModel = observableModule.fromObject({
	    refLink: "http://example.com"

    return viewModel;

module.exports = HomeViewModel;

I need to update this property in SideDrawer onNavigationItemTap() function. How can I do it.


I assume in your codebehind you instantiate this somehow, so just store it in the pages scope and use it in any method you want.

var myModel;

exports.onLoad = function(args){
    myModel = new HomeViewModel();   

exports.onNavigationItemTap = function(args){
   //Do whatever with myModel