gpt4 book ai didi

javascript - 使用 ng-repeat 显示 JSON 数组中的数据

转载 作者:行者123 更新时间:2023-11-27 23:35:31 24 4
gpt4 key购买 nike

这是我的 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-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>

标题、日期、嘉宾姓名按预期显示,但我无法使用 ng-repeat 显示 li 元素内的轨道列表。

感谢任何帮助,谢谢。

最佳答案

如果您想在 ng-repeat 中循环遍历数组,则数组中不能有重复的条目。 https://docs.angularjs.org/error/ngRepeat/dupes

关于javascript - 使用 ng-repeat 显示 JSON 数组中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34164142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com