I'm trying to show the value from #{product.name}
in a textfield. This is my code, but it doesn't work
label Name
input(type='text', placeholder='Name', name='name' value='#{product.name}')
This is my result:
Can someone tell me how to do this?
Assuming that you are using a newer version of pug, string interpolation in attributes has been removed from the language in favor of ES6-template-strings.
This means you are in theory supposed to use syntax like this now:
input(type='text', placeholder='Name', name='name' value=`${product.name}`)
That being said, your example does not require using interpolation at all, and you could simply be passing the variable's value:
input(type='text', placeholder='Name', name='name', value=product.name)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With