5

I'm trying to make Jade work with Meteor's Flow Router and Blaze. Somehow it doesn't work for me. I'm pretty sure it's just something small that I don't notice.

HTML versions of home.jade and layout.jade files give a proper, working result.

According to this, there used to be a problem, but it was solved in 0.2.9 release of mquandalle:jade.

$ meteor list

blaze                2.1.2  Meteor Reactive Templating library
kadira:blaze-layout  2.0.0  Layout Manager for Blaze (works well with FlowRou...
kadira:flow-router   2.3.0  Carefully Designed Client Side Router for Meteor
meteor-platform      1.2.2  Include a standard set of Meteor packages in your...
mquandalle:jade      0.4.3  Jade template language

layout.jade

template(name="layout")
  +Template.dynamic(template="main")

home.jade

template(name="home")
  p Looks like working!

routes.js

FlowRouter.route('/', {
  name: 'home',
  action: function() {
    BlazeLayout.render('layout', {main: 'home'});
  }
});

The result:

<body>
  <div id="__blaze-root">
  </div>
</body>
smyslov
  • 1,279
  • 1
  • 8
  • 29
ddarkowski
  • 338
  • 1
  • 9

1 Answers1

6

Indeed, it is just a subtle detail issue: you should not use quotes around the main parameter in your layout template:

template(name="layout")
  +Template.dynamic(template=main)
SylvainB
  • 4,765
  • 2
  • 26
  • 39
  • Thank you! Now it's working fine. And here I was starting to think of sticking to pure HTML. – ddarkowski Aug 25 '15 at 09:28
  • how can you pass variables to the dynamic call? Like this: `+template(data='abcdef' moredata='moreabc')` or in this case `+main(date='abcd')`? – Gobliins Feb 04 '21 at 11:39