我有一个ember hbs组件,其中我们有表,其中td的值应该根据前一个td的值来决定,这是我的hbs代码,请帮助?
<div class="row">
<div class="col-md-12">
{{#if model.novs}}
<table class="table table-striped">
<thead>
<tr>
<th>Notice#</th>
<th>Type</th>
<th>Violation</th>
<th>Inspection Item</th>
<th>
Action
</th>
</tr>
</thead>
<tbody>
{{#each model.novs as |nov index|}}
<tr>
<td>{{nov.NOVNumber}}</td>
<td>{{nov.NOVNoticeTypeName}} {{nov.ViolationTypeName}}</td>
<td>
{{#each nov.Violations as |novv index|}}
{{novv.ViolationNumber}}
{{novv.Year}}
{{novv.Make}}
{{novv.Model}}
{{#if novv.Vin}}(VIN#:
{{novv.Vin}})
{{/if}}
<br />
{{/each}}
</td>
<td>
{{#each model.result.items as |novi index|}}
{{novi.itemNum}}
<br />
{{/each}}
</td>
<td>
{{#if isResCompletedStatus}}
<div class="btn btn-xs btn-default" onclick={{action "editNov" nov.NOVId}}>
<i class="fa fa-eye"></i>
View Notice
</div>
<div class="btn btn-xs btn-default" onclick={{action "generatePreCase" nov.NOVId }}>
<i class="fa fa-file"></i>
Generate Investigation
</div>
{{else}}
<div class="btn btn-xs btn-default" onclick={{action "editNov" nov.NOVId}}>
<i class="fa fa-edit"></i>
Edit Notice
</div>
{{/if}}
</td>
</tr>
{{/each}}
</tbody>
</table>
{{else}}
{{#unless isResCompletedStatus}}
{{#link-to 'result.details.nov.details' 0 disabled=isResFormDisabledBoolean}}
<div class="well text-center no-margin">
Click here to add a Notice.
</div>
{{/link-to}}
{{else}}
<div class="well text-center no-margin">
No notices...
</div>
{{/unless}}
{{/if}}
</div>
</div>
在上面的代码中,model.result.items有Violation元素,我如何才能显示novv.ViolationNumber的诺维.itemNum,请提供帮助-提前感谢。
1条答案
按热度按时间kgqe7b3p1#
我不是100%清楚你的问题,但是我认为你希望通过一个值(
novv.ViolationNumber
)来过滤一个集合(model.result.items
)。如果是这样的话,你可以使用ember-composable-helpers#find-by。