express - jade loop not able to access variable in node.js file -
I am looking for this solution for days and would prefer any solutions or recommendations.
I node According to JS, XP, and Mogo DB, I am creating a very simple blog. I am doing this as a practice to understand nodes better, because I do not know very well right now.
I followed all the instructions, keeping in mind the differences in the accounts in the versions, and till I can not find the tutorial at the top, "A View to Kill", where I am in a Z file Send some dummy data.
If I do not leave the code in my app js file, the z file is being passed in it:
var authors = new ArticleProvider (); App.get ('/', function (Rick, Race) {articleProvider.findAll (function (error, docs) {res.send (docs);}}}}) app.listen (3000);
I get a render of the data object.
But when I sang in the Z file, I get an error:
typeError: undefined
... Can not read the property 'length' ... which refers to each loop in my Z file (line 3), which is here:
h1 = title # Article - Article in each Article div.article div.created_at = article.created_at div.title a (href = "/ blog /" + article._id)! = Article.title div for the whole person's guit .body = article.body
article
reference is undefined. Try changing your render code to the following:
app.get ('/', function (rik, ridge) {articleProvider.findAll (function (error, docs) {res.render ('Index.jade', {article: docs});});});
Comments
Post a Comment