AngularJS 1:如何将索引作为表达式绑定到html中的数组?

AngularJS 1: How to bind index as expression to an array in html?

我没有什么问题。我正在尝试使用 ng-repeat 显示一些数据:

ng-repeat="color in apples[{{index}}].color"

其中

$scope.index = $stateParams.index;

但是,我收到语法错误。

在这个例子中动态添加索引到数组的正确方法是什么?

只需使用循环索引:

ng-repeat="color in apples[$index].color"

ng-repeat="color in apples[index].color"