Global observable from parent to children

In my MainView I have JS like:

var Observable = require("FuseJS/Observable");
var auth = Observable();

function changeAuth(args) {
  auth.value = args.auth;
  console.log(JSON.stringify(auth.value)); //this shows correct value

module.exports = {
  auth: auth,
  changeAuth: changeAuth,

After that in the child component I try to do:

var mainview = require("main-view.js");

but this gives a null value every time. Tried to tie that up in onValueChanged but that didn’t help.
Am I missing something? Is there a better way to pass the global variable to child components?

Hi Marcin, welcome to the MVVM world!

For a solution, take a look at this forum post and another forum post.

Hope this helps!

That was really helpful ! Thank You.