-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there Child / Sub Templates Support? {{> myOtherTpl}} #51
Comments
This should work as you've written it. If not you can use a dynamic template. However see this issue #52 - you must explicitly specify data context for dynamic templates. Perhaps you also need to explicitly specify data context for sub templates too. |
@zeroasterisk: Can you share which solution you have used? I'd love to have some infos on this 👍 |
hi @zeroasterisk: same as @thebarty, It would be cool to know how you solve this stuff (have the same, tried with data context with no result :( ) Thanks ! |
It was a typo, {{> childTemplate}} inclusion works (don't forget to do a SSR.compileTemplate('chilTemplate', Assets.getText('childTemplate.html')) before). Sorry for the noise ! |
Hi @po-jo, Server code: SSR.compileTemplate('basicData', Assets.getText('contract/basicData.html'));
SSR.compileTemplate('main', Assets.getText('contract/main.html'));
var html_string = SSR.render('main', {
css: css,
contract: contract
}); Template code: {{{getDocType}}}
<html>
<head>
<meta charset="utf-8">
<title>MVMCo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
{{css}}
</style>
</head>
<body class="body-contract-report">
<h1>{{ contract.code }}</h1>
{{> basicData contract=contract }}
</body>
</html> So I just render the "main" template and I expected that its child renders too, but it doesn't happen, only rendered the main template content. |
Forget it man, it was because I had the "template" tag into the child template, but in the server templates it doesn't necessary. |
Is there Child / Sub Templates Support?
{{> myOtherTpl}}
How do I set that up?
The text was updated successfully, but these errors were encountered: