Coffeescript 基于特定模板的Meteor订阅
我在meteor网页上工作,在那里我订阅了两个不同的设置并发布了数据。我在我的路由器上订阅这些 **路由器**Coffeescript 基于特定模板的Meteor订阅,coffeescript,meteor,Coffeescript,Meteor,我在meteor网页上工作,在那里我订阅了两个不同的设置并发布了数据。我在我的路由器上订阅这些 **路由器** @route 'chat', path: '/chat/:room_name' notFoundTemplate: 'home' loadingTemplate: 'Loading' waitOn: -> Meteor.subscribe('rooms') Meteor.subscri
@route 'chat',
path: '/chat/:room_name'
notFoundTemplate: 'home'
loadingTemplate: 'Loading'
waitOn: ->
Meteor.subscribe('rooms')
Meteor.subscribe('messages', @params.room_name)
data: ->
if Meteor.user()
Rooms.findOne({room_name: @params.room_name})
action: ->
if @ready()
@render()
流星正按它应有的样子运行。我的意思是,每当更新房间或消息时,我页面上的两个模板都在更新它们的数据。我需要的是把这个分开
即,当更新房间时,只有我的房间模板更新,而当更新邮件时,只有我的邮件模板更新
我假设我需要将我的订阅放在特定的区域才能实现这一点,但我不确定将它们放在哪里 这可能是不相关的,但是如果您确实想同时等待这两个,那么您的waitOn应该返回一个数组。类似于:waitOn:->[Meteor.subscribe…,Meteor.subscribe…]我建议使用Template.myTemplateName.created hook。