意外的令牌'插值'的NodeJS

时间:2016-03-26 02:22:54

标签: node.js pug

我收到此错误我正在尝试将href设为/sendnotify/room.roomNumber。

Error: /root/13h31762/views/classmanager.jade:14
    12|                                 -var roomurl = "/sendnotify/"+ room.roomNumber;
    13|                                 li your Classes --->
  > 14|                                 a(href=roomurl, class='roomlink')#{room.roomName}
    15|                                 
    16| 

Unexpected token `interpolation` expected `text`, `code`, `:`, `newline` or `eos`

我不知道为什么。我的玉视图包含在下面

extends layout

block content
    div.container
        div.row
            div.col-sm-6.col-md-4.col-md-offset-4
            #user
                    h1.text-center.login-title Welcome #{user.firstName}. Check your details below:
                        div.signup-wall
                            ul.user-details
                            each room in user.room
                                -var roomurl = "/sendnotify/"+ room.roomNumber;
                                li your Classes --->
                                a(href=roomurl, class='roomlink')#{room.roomName}

1 个答案:

答案 0 :(得分:1)

尝试在变量之前为roomname添加空格:

a(href=roomurl, class='roomlink') #{room.roomName}

或者,因为您只能使用a-tag中的变量:

a(href=roomurl, class='roomlink')= room.roomName