简体   繁体   English

在文本区域内使用pug模板引擎显示变量值

[英]display variable value using pug template engine inside textarea

I am getting data from mongodb and when display variable value in pug in a text-area the output of description variable <hello my name is ahmed></hello my name is ahmed> the data stored in description just hello my name is ahmed code in view 我从mongodb获取数据,当在文本区域中的pug中显示变量值时,描述变量的输出<hello my name is ahmed></hello my name is ahmed>存储在描述中的数据只是hello my name is ahmed代码鉴于

.row
    .col-md-6
          .form-group
                label(for='inputPassword3') Description
                textarea#inputPassword3.form-control(name="description", cols="30", rows="10" placeholder="Description") 
                    if user.description != undefined || user.description != null
                        #{user.description}

its related to pug template engine to display value we should use this | #{user.description} 它与哈巴狗模板引擎相关,以显示价值,我们应该使用此| #{user.description} | #{user.description} to avoid converting variable value to tag inside text-area so the updated code will be | #{user.description}避免将变量值转换为文| #{user.description}标记,因此更新后的代码将是

  `.row
        .col-md-6
            .form-group
                label(for='inputPassword3') Description
                textarea#inputPassword3.form-control(name="description", cols="30", rows="10" placeholder="Description") 
                    if user.description != undefined || user.description != null
                        | #{user.description}` 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM