meteor not printing any data

Pavan K

I have the following application and when I render data I am getting null or no data for the {{video}} tag even though data exists in the collection Can anyone help me find the mistake

routes.js

Router.route('/videos/:id', function () {
  var item = Videos.find({_id: this.params._id});
  this.render('VideoItem', { data:item});
});

video.html

<template name="VideoItem">
  <div class="container">
    <h3> Video Information</h3>
    {{video}} 
  </div>
</template>

video object when Videos.find().fetch()

_id: "FEXm65hwZ9QWXFSY8"
created_at: Mon May 18 2015 14:22:59 GMT+0200 (CEST)
duration: 10000
video: "temp"
videourl: "http://google.com"
__proto__: Object
David Weldon

find returns a cursor. That would work if you were iterating over a set of videos with #each. In your case you want a specific video so you'd need to use findOne like this:

Router.route('/videos/:_id', function () {
  this.render('VideoItem', {
    data: function () {
      return Videos.findOne(this.params._id);
    }
  });
});

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Python SQLite3 function not printing any data

分類Dev

Printing data in listview to firebase

分類Dev

Profiling data for Meteor application

分類Dev

Why isn't this printing any new lines?

分類Dev

Is there any printing error here in this code? (python)

分類Dev

Is there any way to align "=>" when printing out arrays?

分類Dev

Meteor access data context in onCreated

分類Dev

Push arbitrary data to a Meteor server

分類Dev

Displaying data from Meteor 1.0

分類Dev

Removing non-printing characters from XML text (or any string)

分類Dev

Processing large json's using logstash - Not working and not printing any error

分類Dev

bash: Is there any way of printing two files with a single command?

分類Dev

Printing the values of specific data types in C?

分類Dev

Meteor : how to publish custom JSON data?

分類Dev

Meteor JS: How to expire mongo data automatically?

分類Dev

Insert data in collection at Meteor's startup

分類Dev

Using react-meteor-data from Typescript

分類Dev

Meteor: Call function after template is rendered with data

分類Dev

how to push data back to client in meteor?

分類Dev

How to update data in Meteor using Reactivevar

分類Dev

Meteor $ and with $ or

分類Dev

Meteor/Iron router: how to wait on data which depends on other data

分類Dev

Ajax request is not giving any data

分類Dev

Python, any() method for data analysis

分類Dev

XSLT transformation not showing any data

分類Dev

Loop through rows, data instead of just printing table in Jinja template

分類Dev

Meteor - Passing data from templates to events, on button click

分類Dev

Why is data set with Meteor Iron Router not available in the template rendered callback?

分類Dev

MongoDB Collection as data source for cs.js in Meteor app

Related 関連記事

  1. 1

    Python SQLite3 function not printing any data

  2. 2

    Printing data in listview to firebase

  3. 3

    Profiling data for Meteor application

  4. 4

    Why isn't this printing any new lines?

  5. 5

    Is there any printing error here in this code? (python)

  6. 6

    Is there any way to align "=>" when printing out arrays?

  7. 7

    Meteor access data context in onCreated

  8. 8

    Push arbitrary data to a Meteor server

  9. 9

    Displaying data from Meteor 1.0

  10. 10

    Removing non-printing characters from XML text (or any string)

  11. 11

    Processing large json's using logstash - Not working and not printing any error

  12. 12

    bash: Is there any way of printing two files with a single command?

  13. 13

    Printing the values of specific data types in C?

  14. 14

    Meteor : how to publish custom JSON data?

  15. 15

    Meteor JS: How to expire mongo data automatically?

  16. 16

    Insert data in collection at Meteor's startup

  17. 17

    Using react-meteor-data from Typescript

  18. 18

    Meteor: Call function after template is rendered with data

  19. 19

    how to push data back to client in meteor?

  20. 20

    How to update data in Meteor using Reactivevar

  21. 21

    Meteor $ and with $ or

  22. 22

    Meteor/Iron router: how to wait on data which depends on other data

  23. 23

    Ajax request is not giving any data

  24. 24

    Python, any() method for data analysis

  25. 25

    XSLT transformation not showing any data

  26. 26

    Loop through rows, data instead of just printing table in Jinja template

  27. 27

    Meteor - Passing data from templates to events, on button click

  28. 28

    Why is data set with Meteor Iron Router not available in the template rendered callback?

  29. 29

    MongoDB Collection as data source for cs.js in Meteor app

ホットタグ

アーカイブ