Subscribe to change on observable inside a module.

What is wrong with this picture… I have a module that manages the content fetched from an API. I would like the UX to be updated whenever the content is fetched and the content observable updated with the new content. My problem is that every time I fetch the content, and the content is passed into the content observable, the UX doesnt get updated with the values. Each is allways empty.

MyModule.js

var Observable = require('FuseJS/Observable');
var content = new Observable();

function fetchContent(){
   //...fetch something then set the content into content using content.replaceAll(items)....
}

module.exports = {
    content: content,
    fetchContent: fetchContent,
}

myUx.ux

<JavaScript>
var myModule = require('MyModule')

myModule.fetchContent();

module.exports = {
      contentFromModule : myModule.content,
}
</JavaScript>
...
<Each Items="{contentFromModule}">
     <!-- Do something with each item -->
</Each>
...

Hi Palton,

the code you’ve posted appears to be just fine. We’ll need to see more of the code to help.

Have you tried adding console.log()s all over the place to make sure everything gets called?

Thank you Uldis!

Not shure what happened, but restarting Fuse did the trick.

Keep up the good work! :slight_smile: