【发布时间】:2016-06-19 17:52:33
【问题描述】:
我在客户端订阅了收藏。在集合上的新插入之后,只是重定向到该插入集合的查看页面。
在服务器上使用“postDetail”集合发布
Meteor.publish('postDetail', (postId: string) => {
return PostCollection.find({ _id: postId });
});
插入页面:
collection.insert(this.currentPost, (error, postId) => {
if (postId) {
this.router.navigate(['detail', { postId: postId }]);
}
else {
}
});
在查看页面:
this.subscribe('postDetail', this.postId, () => {
collection.findOne({ _id: this.postId});
**// this is not giving the inserted data at first time**
});
【问题讨论】:
-
我认为你需要更清楚你的实际问题是什么。该主题的问题非常广泛,最好通过阅读手册来回答。你的实际问题是什么?
-
在插入成功回调时重定向但没有在下一页获取数据。