ng-repeat在其他ng-repeat中不起作用 [英] ng-repeat in other ng-repeat is not working
本文介绍了ng-repeat在其他ng-repeat中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
{
"data": {
"name": "NAME",
"tests": [
{
"testname": "abc",
"relatedResource": [
{
"accessType": "fttb",
},
{
"accessType": "fttn",
}
]
},
{
"testname": "xyz",
"relatedResource": [
{
"accessType": "fttp",
},
{
"accessType": "fttp",
}
]
}
]
}
}
控制器
$scope.data=response.data.tests;
<div ng-repeat="l in data">
<div ng-repeat="i in l.relatedResource">
{{i.accessType}}
</div>
</div>
推荐答案
有关该问题的信息实际上并不多.
There is actually not much information about the question.
如果从远程服务器接收到json-data,则应始终检查并将其转换为真实的json-object.
If you receive the json-data from a remote server, you should always check and convert it to a real json-object.
您可以简单地使用
$scope.data = response.data.tests;
$scope.getData = function()
{
return angular.toJson($scope.data);
}
或者您可以通过以下方式进行测试:
or you can test it with:
{{data | json}}
这篇关于ng-repeat在其他ng-repeat中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文