0
我有這樣的HomeLayout.html:流星Iron.Router動態模板
<template name="HomeLayout">
<main>
{{>Template.dynamic template=main}}
</main>
</template>
而一個LoginLayout.html這樣的:
<template name="LoginLayout">
<main>
<p> Login Layout Test </p>
</main>
</template>
我想裏面輸入HomeLayout這LoginLayout 。 要啓動HomeLayout我用這個代碼:
Router.route('/', function() {
this.render('HomeLayout');
});
但我不知道我怎麼可以加載內部HomeLayout這LoginLayout ...
不能使用{{> yield}}工作,並使用當前路由名稱查找匹配的模板? –
@JanJoukeTjalsma是的,但動態模板通常不受i-r控制,它們由提供傳遞給動態模板的變量控制。動態模板提供了對'{{> yield}}'的額外控制,例如,當您想要跨模板共享事件映射時,它非常有用。 –