Search code examples
node.jsexpressnode-blade

NodeJS: Express: node-blade: Live UI


I am using Node.JS/express and node-blade (npm blade) as the template engine.

I'm trying to take advantage of the fantastic Live-UI feature set in Blade, but can't seem to get the Live updating views working; i.e when rendering content into an element any changes to the Model after the initial render are not reflected in the view.

The client side isn't throwing any errors, and events such as {click} and {change} work in the templates, but the view won't update to any changes in the Model without re-rendering the template.

On the browser;

systemVM = new blade.Model({test: 'stackoverflow'});
$('#wrap').render('pub/login', systemVM);

In the template;

h1 Hello #{test}
input
  {change}
    test='World!';

Have also tried; (on the browser)

systemVM.observable.test = 'World';

And; (on the browser)

systemVM.observable.test = 'World';
systemVM.invalidate('test');

And; (on the browser)

systemVM.observable.test = 'World';
systemVM.invalidate('test');
systemVM.sync();

Has anyone had experience getting this going?

It's also worth mentioning that the file 'plugins/deps/deps-utils.js' was missing from the spark-standalone.sh build script for using Meteor's 'Spark' and while spark built without it and isn't throwing any errors, I can't help but think that might be the issue. Have tried building spark-standalone from historical git commits, but every time the build throws errors.

Any help would be really appreciated, this is driving me crazy!


Solution

  • Issues were resolved by the standalone Spark.js file found at http://icomputeconsulting.com/spark.js (hope BMiner doesn't mind me posting this link)

    Use this link: Un-official GitHub Repo