Javascript Meteor:获取并显示github用户名和电子邮件
我从GitHub API获得了用户名和电子邮件地址。但它不显示在流星。它适用于profile.name,但不适用于services.github.username或电子邮件Javascript Meteor:获取并显示github用户名和电子邮件,javascript,html,github,meteor,meteorite,Javascript,Html,Github,Meteor,Meteorite,我从GitHub API获得了用户名和电子邮件地址。但它不显示在流星。它适用于profile.name,但不适用于services.github.username或电子邮件 Template.input_box.events = { "keydown input#message" : function(event){ if (event.which == 13) { // 13 is the enter key event if (Meteor.user()
Template.input_box.events = {
"keydown input#message" : function(event){
if (event.which == 13) {
// 13 is the enter key event
if (Meteor.user())
{
var name = Meteor.user().profile.name;
// var git_userid = Meteor.user().services.github.username;
// var git_email = Meteor.user().services.github.email;
}
这很奇怪,因为Meteor.user().services.github.username;工作在控制台模式,但若我把我的代码和运行在本地主机,它不会显示任何东西。。。调用此函数的代码
{{git_email}} {{git_userid}} // does not work
{{name}} // works
如何使它们工作,以便我可以在HTML中插入电子邮件和用户名信息
谢谢流星的祝福
默认情况下,当前用户的用户名、电子邮件和个人资料
发布到客户端
因此,您需要在服务器上手动发布用户的“服务”字段
Meteor.publish("userData", function () {
return Meteor.users.find({_id: this.userId},
{fields: {'services': 1}});
});