PUG:如何在pug中的另一个对象内显示JSON对象的元素

时间:2019-11-04 21:35:20

标签: json pug

我正在尝试使用以下Pug布局显示一组数据:

  table(class='table')
    thead(class='thead-dark')
      tr
        th Message
        th From
        th Class
        th Text
        th Sent
      tbody
      each message in message_list
        tr
          td #{message.message_type}
          td #{message.from_attendee}
          td
            a(href='/classes/'+message.for_class) #{message.for_class}
          td #{message.full_message}
          td #{message.string_time_sent}

现在,message.from_attendee是对已从数据库填充的对象的引用,因此在上面的示例中显示

{"classes":[],"_id":"5db1c4e58c49732f54c41ec9","first_name":"Paul","last_name":"T","phone":"","email":"","active":"Active","__v":0}

我想要实现的是在哈巴狗中引用message.from_attendee.first_name。阅读一些帖子,但它们似乎无济于事。

0 个答案:

没有答案