我需要使用ng-repeat读取此json文件。这是一个嵌套的json文件。我需要显示带有其源名称的文章列表,其描述和URL代码如下:
{
"status": "ok",
"totalResults": 20,
"articles": [
{
"source": {
"id": "the-washington-post",
"name": "The Washington Post"
},
"author": null,
"title": "White House expresses confidence on Kavanaugh confirmation, even as key senators remain unannounced",
"description": "“As of now, I don’t really know, and I don’t know if anyone else does,” the Senate Judiciary Committee chairman said.",
"url": "https://www.washingtonpost.com/politics/kavanaugh-vote-hours-before-a-key-test-grassley-says-he-doesnt-know-how-it-will-go/2018/10/05/a71d92ba-c886-11e8-b1ed-1d2d65b86d0c_story.html",
"urlToImage": "https://www.washingtonpost.com/resizer/GAc4DRZ9o0B5kqDbhd80-2j5b9U=/1484x0/arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/42Q37CWIREI6RMPNDUWWLODNBQ.jpg",
"publishedAt": "2018-10-05T13:18:45Z",
"content": "The White House expressed confidence Friday morning that Judge Brett M. Kavanaugh will be confirmed to the Supreme Court, even though several key senators have yet to announce how they will vote in today’s crucial procedural motion. “We are confident Judge Ka… [+6945 chars]"
},
{
"source": {
"id": null,
"name": "Bbc.com"
},
"author": "https://www.facebook.com/bbcnews",
"title": "S-400: India missile defence purchase in US-Russia crosshairs",
"description": "India's purchase of the Russian-made S-400 air defence system runs the risk of US sanctions. So why buy it?",
"url": "https://www.bbc.com/news/world-asia-india-45757556",
"urlToImage": "https://ichef.bbci.co.uk/news/1024/branded_news/9198/production/_103727273_c277ce01-cf10-4984-b5b0-92322020a50f.jpg",
"publishedAt": "2018-10-05T12:57:36Z",
"content": "Image copyright Getty Images Image caption Russian President Vladimir Putin (left) and Indian PM Narendra Modi signed the deal in Delhi on Friday India has signed a deal with Russia to acquire the S-400 air defence missile system, despite the possibility such… [+6864 chars]"
}
]
}
这是我的控制人
$scope.showNews = function(){
MainDash.getNews().then(function(data){
$scope.newsData = data.articles;
})
}
这是我的服务
factory.getNews = function(){
return $http.get('news.json');
}