Express+jade: local variable not available in view

前端 未结 3 2310
迷失自我
迷失自我 2021-02-19 03:41

I ran into a very basic problem but I can\'t seem to find the answer to it. I am working with node.js, express and I am just trying to pass a local var

3条回答
  •  旧时难觅i
    2021-02-19 04:35

    h1 = title tries to evaluate it locally, the title you sent and that one is different. To understand the difference see:

    - var title = 'my title' // - allows writing code
    h1 = title
    

    The one you should use is:

    h1 #{title}
    

提交回复
热议问题