2017-07-14 53 views
0

我使用Pug创建链接。未将数据嵌入链接

each evnt in evnts 
      .row.list-group 
       .col-xs-12.list-group-item 

        h4 
         a(href='/details/#{evnt._id}') #{evnt.name} 
         small   
        p #{evnt.dateTime} 
        p #{evnt._id} 

页面呈现正确,并显示正确的数据。

让我们假设#{} evnt._id是1234

当我点击链接,我重定向到/details/#{evnt._id}而不是/细节/ 1234。

这是为什么?

回答

2

如果您在帕格2.0的时候,语法改变like this

上面的代码应更改为a(href='/details/' + evnt._id)