How to embed a value inside a string in a pug

Hi guys, I'm trying to insert a value inside the pug html attribute. I can't seem to find documentation on how to do this. Here is my code

input(type='hidden', name='country', value='#{val.snippet.id.videoId}')

as you can imagine, val.snippet.id.videoIdthis is just a javascript variable that I am moving from my server side. Therefore, I want to set the value attribute of this variable. It would be very helpful if someone points me in the right direction.

+4
source share
2 answers

Is it something like this job?

input(type='hidden', name='country', value=val.snippet.id.videoId)

As far as I remember, you do not need to interpolate the variables in the attributes, just use them after =.

+3
source

( ) Pug 0.1.0 (Jade 2.x), .

, :

input(type='hidden', name='country', value=val.snippet.id.videoId)
+2

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


All Articles