Printing variables inside a jade file

I want to print the default value for my textarea forms, I have the code below

 textarea(class="form-control",name="details")
     if restaurant.details
          #{restaurant.details}

but if my value is set (restaurant.details), it will look like a tag without text, how to print text inside my text box?

+4
source share
2 answers

Use the operator |:

 textarea(class="form-control",name="details")
     if restaurant.details
       | #{restaurant.details}

codepen

From docs

The easiest way to add plain text to templates is to prefix the line with | (pronounced "pipe").

+7
source

!{...} #{...}, /.

+4

Source: https://habr.com/ru/post/1527107/


All Articles