我想在結果子數組對象的訪問值:在JSON訪問中嵌套子對象的值與角
results: [
{
list_name: "E-Book Fiction",
display_name: "E-Book Fiction",
bestsellers_date: "2016-09-03",
published_date: "2016-09-18",
rank: 1,
rank_last_week: 0,
weeks_on_list: 1,
asterisk: 0,
dagger: 0,
amazon_product_url: "http://rads.stackoverflow.com/amzn/click/1250022134",
isbns: [],
book_details: [
{
title: "A GREAT RECKONING",
description: "An instructor at the police academy is found murdered, perhaps by one of the cadets favored by Armand Gamache, the retired homicide chief of the Sûreté du Québec.",
contributor: "by Louise Penny",
author: "Louise Penny",
contributor_note: "",
price: 0,
age_group: "",
publisher: "Minotaur",
primary_isbn13: "9781250022127",
primary_isbn10: "1250022126"
}
],
reviews: [
{
book_review_link: "",
first_chapter_link: "",
sunday_review_link: "",
article_chapter_link: ""
}
]
}
,這樣我可以從book_details
搶一樣title
值,但目前只能夠顯示與整個響應:
<article class="search-result row" ng-repeat="books in results">
<div class="col-xs-12 col-sm-12 col-md-3">
{{books}}
</div>
</article>
我的控制是相當簡單,只要抓住了結果:
myBooks.controller('bookController', function($scope, $http){
$http.get("data-url")
.success(function(response) {
console.log(response);
$scope.results = response;
});
});
在Web控制檯對象的屏幕截圖:
迭代過書的細節不是結果。 –