简体   繁体   English

表单中带有模板文字的 EJS

[英]EJS with template literals in form

I need insert a id with template literals in action prop, inside a form.我需要在表单内的 action 道具中插入一个带有模板文字的 id。

Example:例子:

 <div> <h6>Cookmaster - Receitas</h6> // Similar Template, but i need a EJS template <form action={`/recipes/${id}`} method="POST"> <label for="title">Título da Receita</label> <input type="text" id="title" name="title" value=<%= title %>> <br> <label for="ingredients">Ingredientes</label> <textarea type="text" id="ingredients" name="ingredients" value=<%= ingredients %>></textarea> <br> <label for="detailsRecipe">Modo de Preparo</label> <textarea type="text" id="detailsRecipe" name="detailsRecipe" value=<%= detailsRecipe %>></textarea> <br> <button type="submit">Enviar Receita</button> </form> </div>

But i don't know how to insert a template literal in this situation.但我不知道如何在这种情况下插入模板文字。

Thanks for help.感谢帮助。

After many attempts, there it is:经过多次尝试,有:

 <form action=<%= `/recipes/${id}` %> method="POST">

tks. tks。

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

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