請試試這個。
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<div ng-app="myApp" ng-controller="namesCtrl">
<div ng-repeat="product in fakeModel">
<div>Product name : {{product.title}}</div>
<div>Product price : {{product.price}}</div>
</div>
</div>
<script>
angular.module('myApp', []).controller('namesCtrl', function($scope) {
$scope.fakeModel = [{
id: 1,
title: 'product',
description: 'description',
price: 10,
tax: 0,
vendorFees: 0,
qty: 0
},
{
id: 2,
title: 'product 2',
description: 'description',
price: 15,
tax: 0,
vendorFees: 0,
qty: 0
}];
});
</script>
我看到你有你的數據在json文件中。使用'$ http.get'獲取它並使用'ng-repeat'遍歷它 – user7
你能舉個例子嗎? – Ivisivel
[Plunkr](http://plnkr.co/edit/fDc5ZE0mwqoaIZfowxgA?p=preview)我對控制器中的'products.json'進行了硬編碼,以演示ng-repeat。 – user7