【发布时间】:2014-08-09 09:25:36
【问题描述】:
我有一条基于 url 参数搜索收藏项的铁路线。如果找到它,它会将该项作为数据上下文返回,否则它会呈现一个notFound 模板。代码如下所示:
this.route('profileView', {
path: list_path + '/profiles/:_id',
fastRender: true,
waitOn: function() {
if (Meteor.user()) {
return [Meteor.subscribe('singleProfile', this.params._id, Session.get("currentListId"))];
}
},
data: function() {
var profile = Profiles.findOne({
_id: this.params._id
});
if (!profile) {
this.render("notFound");
} else
return profile;
}
});
问题是notFound 模板在配置文件返回之前被短暂加载,尽管我认为waitOn 函数会处理这个问题。使用铁路由器获得预期结果的正确模式是什么?谢谢。
【问题讨论】:
标签: meteor iron-router