Retrieving Data from Meteor Collections

前端 未结 5 1335
北恋
北恋 2021-02-08 18:54

I\'m having a few problems when trying to get data from a Meteor Collection and I need some advice.

The collection has been defined, published, and subscribed successful

5条回答
  •  一生所求
    2021-02-08 19:42

    if u've removed autopublish, what if u publish the collection to all user without using a publish name?

    Meteor.publish null, ->
        Products.find {}
    

    where u subscribe your collection ?

    template helper

    Handlebars.registerHelp = 'products', (id) ->
        Product.find _id: Session.get 'productId'
    

    like if we have price in each product. the template part looks like...

    
    
    
    

    the js part, i'll use coffeescript...

    Template['product-item'].price = ->
        console.log @ # @ is this as it is product itself, if we have product inserted.
        console.log this
        return 'the price is: ' + @price
    

提交回复
热议问题