【发布时间】:2023-03-20 15:30:02
【问题描述】:
我看到了对这个 stackoverflow 帖子的回复:Is there a way to pass variables into templates in Meteor?
这篇文章只展示了如何将静态值传递给 blaze 模板。请参阅以下示例 - 我正在尝试将 user.username 传递到模板 cookieTemplate
<template name="userTemplate">
<p> Wellcome {{user.username}} </p>
{{#each user.profile.cookies}}
{{> cookieTemplate username={{user.username}} }}
{{/each}}
</template>
<template name="cookieTemplate">
{{username}} has cookie {{this.cookieName}}
</template>
我知道我可以使用Session.set('username', blah) 来执行此操作,但我想知道是否可以将动态变量传递给模板?
【问题讨论】:
标签: meteor meteor-blaze