形式为模板字面量的 EJS

EJS with template literals in form

我需要在表单内的 action prop 中插入一个带有模板文字的 id。

示例:

  <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>

但我不知道如何在这种情况下插入模板文字。

感谢您的帮助。

经过多次尝试,结果是:

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

谢谢。