小東西卡住....我可以抓住{{value.title}}顯示正常,但獲取內部數組值不顯示,不知道我做錯了什麼這裏......以前從未使用樹枝,所以可能只是我缺少一些東西。使用樹枝模板引擎訪問陣列
PHP
$product_array = array();
foreach ($shopifyProducts as $product) {
$item = array(
"title" => $product["title"], // product title
"variants" => array() // for now an empty array, we will fill it in the next step
);
foreach($product["variants"] as $variant) {
$item["variants"][] = array(
"barcode" => $variant["barcode"], // product barcode
"sku" => $variant["sku"] // product SKU
);
}
$product_array[] = $item; // now we add the item with all the variants to the array with all the products
}
嫩枝
<div class="table-responsive">
<table class="table">
<thead>
<th>Title</th>
<th>Barcode</th>
<th>SKU</th>
</thead>
<tbody>
<tr ng-repeat="value in remote_data">
<td>{{ value.title }}</td>
<td>{{ value.variants.barcode }}</td>
<td>{{ value.variants.sku }}</td>
<td>{{ value.variants }}</td>
</tr>
</tbody>
</table>
</div>
如果我輸出vaule.variants它輸出
[{"barcode":"5060315468600","sku":"PLU#1"}]
但不能似乎得到條形碼和SKU顯示任何想法?
嗨@詹姆斯,我希望我的兩個解決方案的腳ÿ我們需要 – Matteo