Dynamic Components in Meteor

#1

I’m a beginner with Meteor and I’m learning about dynamic templates. At the moment everything is ok with the behavior of this templates, but I’m having troubles trying to make “dynamic components”.

My app has some pages, News, Profile, Messages, etc. but my App_Body template (Always displayed in every page) has a fixed sidebar where I want to load content based in the page context. For example, in News Page I want to load trending topics, in Messages my contacts lists, all in the same sidebar.

It is possible to load content dynamically in a component? Based in my page context. I’m using Flow Router to render my templates, and Blaze is my template engine. Any help would be great, thanks for the time.

1 Like
#2

Hello @juxteby,

  1. What do you use to render a new Template into the page?
  2. What do you use for routing?
  3. Blaze or React?
#3

Hello. I’m using Flow Router to render my templates, and Blaze is my template engine.

#4

Take a look on Templating tutorial. Note it’s for FlowRouter-Extra package.

#5

Thanks @dr.dimitru, actually I have Flow Router + Blaze working very well, my templates load dynamically. But in my App I have a component that should receive content based in the loaded page. This component is showed in every page (Like header and footer), but it’s content must change based in the page context.

#6

You can pass data into those “Regions” via its attributes. Passed data can be reactive and updated upon route change.

Approach from this tutorial can be applied to original FR.

2 Likes
#7

See Template.dynamic

#8

Ok @dr.dimitru I will check that example. Thanks for your help.

#9

Thanks @juho, I’m going to check it :wink: