我的应用程序上的 GET 操作返回数组中的数据:
Value":[{"Id":"6b7","Notes":"testing","CreatedBy":"User1"},{"Id":"6b7","Notes":"Testing 1","CreatedBy":"User2"}]
我使用上面的来填充模板:
<div class="create-note">
<form>
**<input type="hidden" id="Id" name="Id" value="{{this.Value.Id}}" />**
<textarea id="Notes" name="Notes"></textarea>
<button for="" type="submit" class="btn btn-primary ">Add Note</button>
<button type="reset" class="btn">Cancel</button>
</form>
{{#unless this.Value.length}}
<div class="alert alert-info">Notes do not exist.</div>
{{else}}
<table class="table">
<thead>
<tr>
<th style="text-align:left">Note</th>
<th style="text-align:left">Created By</th>
</tr>
</thead>
<tbody>
{{#each this.Value}}
<tr>
<td>
{{this.Notes}}
</td>
<td>
{{this.CreatedBy}}
</td>
</tr>
{{/each}}
</tbody>
</table>
{{/unless}}
</div>
如何填充隐藏的表单字段 (Id)。value={{this.Value.Id}} 不起作用,因为我们有一个数组。