Javascript 使用JSON数组中的ng repeat显示数据
这是我的JSON数据:Javascript 使用JSON数组中的ng repeat显示数据,javascript,angularjs,json,Javascript,Angularjs,Json,这是我的JSON数据: $scope.track = [{ title: 'Group Therapy 150 with Above & Beyond and Maor Levi', date: new Date(), link: "https://www.mixcloud.com/widget/iframe/?embed_type=widget_standard&embed_uuid=a38e8d96-7372-430b-
$scope.track = [{
title: 'Group Therapy 150 with Above & Beyond and Maor Levi',
date: new Date(),
link: "https://www.mixcloud.com/widget/iframe/?embed_type=widget_standard&embed_uuid=a38e8d96-7372-430b-91b3-7549a408ac7c&feed=https%3A%2F%2Fwww.mixcloud.com%2FPlayLifePodcast%2Fdj-nyk-play-life-podcast-003%2F&hide_cover=1&hide_tracklist=1&replace=0",
tracklist: ['Adam Rickfors - Twang Machine (Original Mix)', 'Cirez D - On Off (Tannergaard Remode)', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats', 'Matt Nash & Felix Leiter - Heartbeats'],
guest: 'Guest Mix by Pep & Rash',
guestlist: ['Tom Staar - Bora / S.H.M - Save The World', 'Dimitri Vegas, Like Mike, Ne-Yo - Higher Place (Tujamo Remix)', 'New_ID & Funk Machine - I Wanna Move', 'Knife Party - Lrad', 'Knife Party - Lrad', 'Knife Party - Lrad', 'Knife Party - Lrad', 'Knife Party - Lrad', 'Knife Party - Lrad']
}]
这就是我访问它的方式:
<div id="podcast-wrapper">
<h1>{{track.title}}</h1>
<h4>{{track.date | date}}</h4>
<iframe width="100%" height="180" ng-src="{{track.link | trustAsResourceUrl}}" frameborder="0"></iframe>
<div class="row">
<div class="col-sm-6">
<h3>TrackList</h3>
<ul>
<li ng-repeat="song in track.tracklist">{{song}}</li>
</ul>
</div>
<div class="col-sm-6">
<h3>{{track.guest}}</h3>
</div>
</div>
</div>
{{track.title}
{{track.date | date}
跟踪列表
- {{song}
{{track.guest}
标题、日期、来宾姓名显示为expect,但我无法使用ng repeat在li元素内显示曲目列表
非常感谢您的帮助。如果您想在
ng repeat
中循环使用数组中的重复项,则数组中不能有重复项 所以$scope.track
是数组还是对象?您在console中看到任何错误吗?它是一个数组,为了简单起见,我只显示了数组中的一个对象。在这种情况下,我不知道它如何处理标题、日期等,因为您无法获取具体元素,请尝试从数组中查看属性