How can I include a template based and wrap it in a div based on the URL? It seems that I am missing the point somewhere here.
I have the following link in my template:
<a href="/settings/workflows"><i class="mdi-action-settings"></i>Workflows</a>
and in a different section in the very same template I want to include a template that reflects the URL, e.g.
{{> Template.dynamic template=route}}
route
is a helper function that parses the URL and returns the template name based on the second index of the URL, in the link above it will result in the template workflow
for example.
Now I got it working to a point where it works ONE time - on startup but as soon I click the link, the browser URL changes but the actual content doesn't - the helper also never receives a refresh either.
Any ideas?
Thanks to my co-worker Shakib - we got it figured out - basically I can achieve this with regions and yieldTemplates.
I made an example and pushed it to my github:
https://github.com/flyandi/meteor-iron-router-example
Basically the secret is to configure the static route and use the yieldTemplate as region, e.g.:
['profile', 'billing', 'account'].forEach(function(path) {
Router.route('/settings/' + path, {
yieldTemplates: {
'settings': {to: 'body'}
},
template: path,
});
});
Hope that helps!