【发布时间】:2014-10-07 22:33:23
【问题描述】:
我正在尝试向显微镜应用程序添加个人资料页面。感谢帮助我得到了here 我能够让它大部分工作,但我无法获得另一个用户配置文件的路径来工作。这是路线的代码。谢谢
在comment.html模板中
<span class="author"><a href="{{pathFor 'user_profile'}}">{{username}}</a></span>
路由器.js
this.route('user_profile',{
path: '/profile/:_username',
waitOn: function () {
return Meteor.subscribe('userprofile', this.params._username)
},
data: function () {return user.findOne(this.params._username)}
});
publications.js
Meteor.publish('userprofile', function (username) {
return user.find(username);
});
profile.js
Template.user_profile.helpers({
username: function() {
return this.user().username;
},
bio: function() {
return this.user().profile.bio;
}
});
【问题讨论】:
-
user集合是什么?默认 Meteor 用户集合是Meteor.users。 -
我认为是默认的accounts_base和accounts_password。我对此很陌生
标签: javascript html meteor iron-router