kakajansh / famono-iron-router

Meteor app boilerplate with Famono + Iron Router
http://shopp.meteor.com
1 stars 0 forks source link

How to put in reactive Content #1

Open ghost opened 9 years ago

ghost commented 9 years ago

Hi there,

thank you for the fame.

Looking at your github repository famous-meteor I was wondering how to set the content of a Surface to a Template in a reactive way. Since UI.insert(UI.renderWithData(template, data) is depreciated, it must be something with Blaze.render(Template.name) or alike?

Regards

ghost commented 9 years ago

I just figured it still goes with UI.insert, although depreciated. Thx anyway

kakajansh commented 9 years ago

Hello,

I advice you to take a look at https://github.com/particle4dev/famodev. Especially, where https://github.com/particle4dev/famodev/blob/releases/src/reactive/ReactiveTemplate.js. Below author provided some examples

Sadly it is not compatible with famono, but you can clone it, and easily edit to require with famono

define('famodev/reactive/ReactiveTemplate',[
    'require', 
    'exports',
    'module',
    'famous/core/Surface'
    ],
    function(require, exports, module){

to

define(function(require, exports, module) {

And in your lib/smart.require

    "famodev": {
        "path": "/your_local_clone/famodev/src"
    },

You are ready

var ReactiveTemplate = famodev.reactive.ReactiveTemplate;

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

Hope it helps. And instead of Iron Router take a look at https://github.com/sayawan/flowwy

kakajansh commented 9 years ago

Update

I cloned that famodev repo and make it compatible with Famono. Here it is https://github.com/sayawan/famodev