Ang*_*yJS 0 angularjs angularjs-directive angularjs-scope angularjs-ng-repeat
我如何使用 ng-repeat 在 UI 上使用 angularJS 迭代来自服务器的 JSON 响应?
$scope.data = {
"Home Needs": [{
"id": 11,
"itemName": "PARLE G 500 Grams",
"itemPrice": 50,
"minSellPrice": 45,
"discount": 0,
"store": "Home Needs"
}],
"SRI SAI Store": [{
"id": 1,
"itemName": "PARLE G 500 Grams",
"itemPrice": 50,
"minSellPrice": 45,
"discount": 0,
"store": "SRI SAI Store"
}],
"Ashirwad": [{
"id": 10,
"itemName": "PARLE G 500 Grams",
"itemPrice": 50,
"minSellPrice": 46,
"discount": 0,
"store": "Ashirwad"
}]
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我使用 jsfiddle 或指针吗?
谢谢
请检查Jsfiddle
<div ng-app>
<div ng-controller="ClickToEditCtrl">
<p>Your Data:</p>
<ul ng-repeat="(key, value) in data">
name: {{key}}
<li ng-repeat="v in value">
{{v.id}},
{{v.itemName}},
{{v.itemPrice}},
{{v.minSellPrice}},
{{v.discount}},
{{v.store}}
</li>
</ul>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
您可以根据需要进行修改。我希望这可能会有所帮助。
归档时间: |
|
查看次数: |
8946 次 |
最近记录: |