Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store value in input (Node, Sequelize, Pug)

I have a question about a blogpost-app I'm trying to build with i.a. node.js, sequelize and pug.

I am looping through an array with blogposts and I would like to create an input (which I later on am going to make hidden) with a value that comes from the array. However, when I run the app the form doesn't show the id of the post. Instead it shows #{post.id}.

What am I doing wrong?

each post in allblogposts
    p 
    strong Blogpost # 
    = post.id
    p #{post.title}
    p= post.body
    p= comment
    form(role='form', action='comment', method='post')
         .form-group
    input#comment.form-control(name = 'comment')
    p= post.id
    input#blogpostid.form-control(type="text", name="hello" value="#{post.id}")
    button.btn.btn-default(type='comment', value = 'comment') Comment

EDIT: Solved it. Pug's syntax differs from the jade syntax. https://github.com/pugjs/pug/issues/2305


1 Answers

Solved it. Pug's syntax differs from the jade syntax. https://github.com/pugjs/pug/issues/2305

input#blogpostid.form-control(type="hidden", name="postid", value=post.id)