当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Inject JS global var in Jade template

问题描述:

I have a form that is created in Jade ans then compiled. I need to pass the Label name with Javascript.

So the javascript var will look like this :

var trans = {"formFirstName": "First Name"}

in the form.jade currently its

.field.first_name

label First Name

.input-wrapper

input(type="text")

But I want First Name to be the variable. I am very new in jade and node. I have no idea how to do that.

网友答案:

Replace the text "First Name" with #{formFirstName} . For more samples, refer to this link http://naltatis.github.io/jade-syntax-docs/#text

.field.first_name
  label #{formFirstName}
  .input-wrapper
    input(type="text")
分享给朋友:
您可能感兴趣的文章:
随机阅读: