您好如何在for循环中传递动态值。在value={{ product.size.0.size }}
中
而不是0,我想传递索引值
{% for no_of in product.size %}
{{ forloop.counter }}
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label or="">Product Size</label> <input class="form-control" placeholder="Alpha-Numeric characters"
required="required" type="text" name="product_size" id="product_size" value="{{ product.size.0.size }}">
<div class="help-block form-text with-errors form-control-feedback"></div>
</div>
</div>
</div>
答案 0 :(得分:0)
不,你不知道。您已经在遍历实际列表,而不是数字。
$services = Service::all()->makeHidden(['appendField1', 'appendField2'])->toArray();