【发布时间】:2015-09-10 16:43:47
【问题描述】:
我想(出于好奇)在试用 Meteor 应用程序时查看我的 userId。我正在尝试以这种方式显示它:
HTML:
<body>
. . .
<div class="container">
{{> userIdTemplate}}
{{> postTravelWizard}}
</div>
</body>
<template name="userIdTemplate">
{{getUserId}}
</template>
Javascript:
Template.userIdTemplate.helpers({
getUserId: function () {
return Meteor.userId;
}
});
在 CDT 中单步浏览 .js,我看到 Meteor.userId 的值是“未定义”。我没有经过身份验证 - 只需运行仍然安装了不安全包的应用程序。这就是 userId 未定义的原因吗?
【问题讨论】:
标签: html spacebars meteor-accounts meteor-helper isomorphic-javascript