Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays AngularJS-如何访问数组中的对象数组_Arrays_Angularjs_Nested - Fatal编程技术网

Arrays AngularJS-如何访问数组中的对象数组

Arrays AngularJS-如何访问数组中的对象数组,arrays,angularjs,nested,Arrays,Angularjs,Nested,在c#中,我创建了一个数组,其中包含一个对象数组,并将其传递给Angular Angular通过以下方式接收: $scope.accounts = data.items; 在我的cshtml中,我可以很好地访问这些值: <td>{{account.name}}</td> <td>{{account.primaryAccountManager}}</td> <td>{{account.secondaryAccountManager}}&

在c#中,我创建了一个数组,其中包含一个对象数组,并将其传递给Angular

Angular通过以下方式接收:

$scope.accounts = data.items;
在我的cshtml中,我可以很好地访问这些值:

<td>{{account.name}}</td>
<td>{{account.primaryAccountManager}}</td>
<td>{{account.secondaryAccountManager}}</td>
{{account.name}
{{account.primaryAccountManager}
{{account.secondaryAccountManager}
但不是:

 <td>{{account.subscriptions.expirationDate}}</td>
{{account.subscriptions.expirationDate}

要获取嵌套数组中的expirationDate,我需要做什么?

您需要使用
[ng repeat]
指令在数组上循环

试试看

<div ng-repeat="subscription in account.subscriptions">
  {{subscription.expirationDate}}
</div>

{{subscription.expirationDate}
别忘了检查你的文件

如果您处于ng重复中,请使用:

<td>{{account.subscriptions[$index].expirationDate}}</td>
{{account.subscriptions[$index].expirationDate}

可能是{{account.subscriptions[i].expirationDate}?您能给我们看一下您的数据项吗array@luk492您从何处获得[i]?accounts数组的结构如何?如果您需要适当的帮助,请提供示例数据和预期结果