Meteor:从 Account-Twitter Mongo Collection 获取数据
Meteor: Fetching Data From Account-Twitter Mongo Collection
我正在尝试显示 accounts-twitter 包中的一些数据。我需要用户的个人资料照片、用户名和姓名,所有这些都来自 Twitter。我已经使用 meteor mongo
检查了该数据是否存在。 Profile.html
是我为此存储模板的地方:
<template name="profile">
<div class="col s4">
<div class="z-depth-2">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<img class="circle-profile center-align" src="{{services.twitter.profile_image_url}}" style="border-radius: 50%" width="50px" height="50px"/>
<br>
<span class="card-title">{{profile.name}}</span>
</div>
<div class="card-action">
<a href="http://twitter.com/{{services.twitter.screenName}}">View Profile</a>
</div>
</div>
</div>
</div>
</template>
<template name="display">
{{#each users}}
{{> profile}}
{{/each}}
</template>
我还有 profile.js 使用助手从 collection 获取数据:
Template.display.helpers({
users: function() {
return Mongo.users.find();
}
});
当我查看我的主要区域时,collection 中的配置文件没有显示。请指教。提前致谢!
来自docs
配置文件默认发布并且只能由当前用户更新。存储 Twitter 信息的服务不是因为这会是一个安全问题,因为它包含身份验证令牌。可能最有效的方法是在 onCreateUser()
方法中将这些值复制到配置文件以便发布它们。
您也可以只发布服务中需要的那些字段,但我个人喜欢将其分开,因为它包含敏感信息。
我正在尝试显示 accounts-twitter 包中的一些数据。我需要用户的个人资料照片、用户名和姓名,所有这些都来自 Twitter。我已经使用 meteor mongo
检查了该数据是否存在。 Profile.html
是我为此存储模板的地方:
<template name="profile">
<div class="col s4">
<div class="z-depth-2">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<img class="circle-profile center-align" src="{{services.twitter.profile_image_url}}" style="border-radius: 50%" width="50px" height="50px"/>
<br>
<span class="card-title">{{profile.name}}</span>
</div>
<div class="card-action">
<a href="http://twitter.com/{{services.twitter.screenName}}">View Profile</a>
</div>
</div>
</div>
</div>
</template>
<template name="display">
{{#each users}}
{{> profile}}
{{/each}}
</template>
我还有 profile.js 使用助手从 collection 获取数据:
Template.display.helpers({
users: function() {
return Mongo.users.find();
}
});
当我查看我的主要区域时,collection 中的配置文件没有显示。请指教。提前致谢!
来自docs
配置文件默认发布并且只能由当前用户更新。存储 Twitter 信息的服务不是因为这会是一个安全问题,因为它包含身份验证令牌。可能最有效的方法是在 onCreateUser()
方法中将这些值复制到配置文件以便发布它们。
您也可以只发布服务中需要的那些字段,但我个人喜欢将其分开,因为它包含敏感信息。