<select id="Test" TestAttr="{{:LocationId}}">
{{for #parent.parent.data.Location}}
<option value="{{:LocationId}}" {{if LocationId= *#parent.parent.data.LocationId*}}selected{{/if}}>{{:#parent.parent.data.LocationId}}</option>
{{/for}}
</select>
如何在**。
之间提到的if语句中获取父数组的LocationId答案 0 :(得分:13)
您可以引入在循环内可见的变量 (在官方文件中:Setting contextual template parameters, accessible in all nested contexts as ~nameOfParameter)
<select id="Test" TestAttr="{{:LocationId}}">
{{for #parent.parent.data.Location ~locationId=LocationId}}
<option value="{{:~locationId}}"...