Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何选择翡翠_Node.js_Express_Pug - Fatal编程技术网

Node.js 如何选择翡翠

Node.js 如何选择翡翠,node.js,express,pug,Node.js,Express,Pug,今天我用express为一所学校建立了一个网站。 这是我的模板的一部分: center b u Students br br table thead tr: th First Name th Last Name th Classroom Name th Actions tbody each item, i in stud tr: td #{it

今天我用express为一所学校建立了一个网站。 这是我的模板的一部分:

center
b
 u Students
br
br
table
    thead
        tr: th First Name
            th Last Name
            th Classroom Name
            th Actions
    tbody
        each item, i in stud
                tr: td #{item.FName}
                    td #{item.LName}
                    td
                    each object, j in classr
                        td option(value='#{object.ID}', selected='#{item.class_id}' == '#{object.ID}') #{object.Name}
                    td
                        a(href='/students/edit?id=#{item.ID}') Edit
                    td
                        a(href='/students/delete?id=#{item.ID}') delete
如您所见,第三个'td'为false,我只想在教室数据库表中显示教室名称,并在学生表中显示教室id。我该怎么做

谢谢你的帮助,对我要温柔,我的英语是近似的,我是法国人,在你的第三个td中,缺少一个select标签。然后在each语句下面的迭代中,不需要在option标记之前指定td


答案只是一个假设^^

我自己在翡翠文件里找到的

center
b
 u Students
br
br
table
    thead
        tr: th First Name
            th Last Name
            th Classroom name
            th Actions
    tbody
        each item, i in stud
                tr: td #{item.Nom}
                    td #{item.Prenom}
                    td
                        each object, j in classr
                            if item.class_id == object.ID
                                p #{object.Nom}
                    td
                        a(href='/students/edit?id=#{item.ID}') Editer
                    td
                        a(href='/students/delete?id=#{item.ID}') Supprimer
你是说第三个td是空的吗?您想在这里显示教室名称吗?
center
b
 u Students
br
br
table
    thead
        tr: th First Name
            th Last Name
            th Classroom name
            th Actions
    tbody
        each item, i in stud
                tr: td #{item.Nom}
                    td #{item.Prenom}
                    td
                        each object, j in classr
                            if item.class_id == object.ID
                                p #{object.Nom}
                    td
                        a(href='/students/edit?id=#{item.ID}') Editer
                    td
                        a(href='/students/delete?id=#{item.ID}') Supprimer