1

I've read several posts on this but nothing that would really answer my question in an up-to-date way (i.e. UI.insert is depreciated).

So what's the best way of inserting/rendering a Template into a Surface reactively, meaning, not only one data object (renderWithData), but whatever is defined in the Template.helpers should also be updated reactively. Code tried so far:

var div = document.createElement('div');

//UI.insert(UI.render(function() { return Template.hello; }), div);
surface = new famous.core.Surface({
    //content: Blaze.toHTML(function() { return Template.hello; }),
    //content: div,
    content: '<div class="hell"></div>',
    size: [window.innerWidth, window.innerHeight],
    properties: {...}
  });
  Blaze.render(function() { return Template.hello}, $('.hell')[0]);

These are 3 different approaches I've tried. First UI.insert inserts it, but handlebars-style Helpers are not recognized. Second, toHTML, no reactivity, even when I put everything into a Tracker.autorun(). Third, Blaze.render(...), doesn't work at all.

Is there an easy solution to this?

Phillip Cloud
  • 24,919
  • 11
  • 68
  • 88
user3819370
  • 513
  • 1
  • 6
  • 15

1 Answers1

0

one possible answer is to use Famodev

var ReactiveTemplate = famodev.ReactiveTemplate;

var reactive = new ReactiveTemplate({
  template: Template.mytemplate,
  data: Collection.find().fetch(),
  properties: {
  }
});

Maybe it will be useful in some way http://github.com/dcsan/moflow

mervasdayi
  • 729
  • 6
  • 16