我有一个JSON对象。我想用ng-repeat显示数据。我想使用ng-repeat加载Project: Manoj
和Project: Rainer
中的所有文件。
预期输出
使用ng-repeat
Manoj所有项目使用ng-repeat
Rainer所有项目以下是我的JSON
[
{
"folderName": "manoj",
"files": [
{
"filename": "FLIP_Libraries_v1.6.zip",
"path": "manoj/FLIP_Libraries_v1.6.zip"
},
{
"filename": "blog-img-1.jpg",
"path": "manoj/blog-img-1.jpg"
},
{
"filename": "blog-post-1.jpg",
"path": "manoj/blog-post-1.jpg"
}
]
},
{
"folderName": "rainer",
"files": [
{
"filename": "blog-img-1.jpg",
"path": "rainer/blog-img-1.jpg"
},
{
"filename": "blog-post-4.jpg",
"path": "rainer/blog-post-4.jpg"
},
{
"filename": "comment-img-1.png",
"path": "rainer/comment-img-1.png"
}
]
}
]
答案 0 :(得分:0)
尝试这样的事情。它只有两个VideoDownloader
:一个用于文件夹,一个用于文件。
ng-repeat

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.json = [{
"folderName": "manoj",
"files": [{
"filename": "FLIP_Libraries_v1.6.zip",
"path": "manoj/FLIP_Libraries_v1.6.zip"
},
{
"filename": "blog-img-1.jpg",
"path": "manoj/blog-img-1.jpg"
},
{
"filename": "blog-post-1.jpg",
"path": "manoj/blog-post-1.jpg"
}
]
},
{
"folderName": "rainer",
"files": [{
"filename": "blog-img-1.jpg",
"path": "rainer/blog-img-1.jpg"
},
{
"filename": "blog-post-4.jpg",
"path": "rainer/blog-post-4.jpg"
},
{
"filename": "comment-img-1.png",
"path": "rainer/comment-img-1.png"
}
]
}
]
});