我有一個下面的代碼,我需要在所有出現處提取a
的值。我必須做的是使用<span ng-repeat="x in carname">
作爲父元素,我不想。我怎樣才能直接得到a
的價值。在角js中嵌套ng-repeat
P.S:$scope.carname
不能緩和
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.carname = [
[{
"a": 1
}],
[{
"a": 2
}],
[{
"a": 3
}],
[{
"a": 4
}]
];
})
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<span ng-repeat="x in carname">
<h1 ng-repeat="y in x">{{y.a}}</h1>
</span>
</div>
只會有'a'屬性或更多? –