0
我有這樣的代碼:如何使用角度1.x訪問對象內的數組?
<div class="list" ng-repeat="key in results">
{{key.locations}}
</div>
JSON
[
{
"locations": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
"imgs": ["111.png", "222.png"]
}
]
JS
.controller('ListCtrl', function($scope, $http) {
$http.get("js/data.json").success(function(results) {
$scope.results = results;
});
})
我要循環通過數組1,2,3 ... 任何幫助非常讚賞!
另一個'ng-repeat' –
我可以同時使用兩個嗎? – olivier
嘗試在結果[0] .locations中輸入密鑰,然後在結果中輸入{{key}}' –